/** * @covers Windwalker\DataMapper\RelationDataMapper::find * @todo Implement testFind(). */ public function testFind() { $dataset = $this->object->find(array('cont.access' => 1, new GteCompare('cat.id', 25)), 'cont.title DESC', 1, 3); $sql = <<<SQL SELECT `cont`.`id` AS `id`, \t`cont`.`title` AS `title`, \t`cont`.`catid` AS `catid`, \t`cont`.`created` AS `created`, \t`cont`.`created_by` AS `created_by`, \t`cont`.`access` AS `access`, \t`cat`.`id` AS `cat_id`, \t`cat`.`parent_id` AS `cat_parent_id`, \t`cat`.`title` AS `cat_title`, \t`user`.`id` AS `user_id`, \t`user`.`name` AS `user_name`, \t`user`.`username` AS `user_username` FROM `ww_content` AS `cont` \tLEFT JOIN `ww_categories` AS `cat` ON cont.catid = cat.id \tLEFT JOIN `ww_users` AS `user` ON cont.created_by = user.id WHERE cont.access = 1 \tAND cat.id >= 25 ORDER BY cont.title DESC LIMIT 1, 3 SQL; $items = $this->db->setQuery($sql)->loadObjectList(null, 'Windwalker\\Data\\Data'); $items = new DataSet($items); $this->assertEquals($dataset, $items); }
/** * Test find() * * @covers Windwalker\DataMapper\RelationDataMapper::find * * @return void */ public function testFind() { $dataset = $this->instance->find(array('flower.state' => 1, new GteCompare('category.id', 2)), 'flower.title DESC', 1, 3); $sql = <<<SQL SELECT `flower`.`id`, \t`flower`.`catid`, \t`flower`.`title`, \t`flower`.`meaning`, \t`flower`.`ordering`, \t`flower`.`state`, \t`flower`.`params`, \t`category`.`id` AS `category_id`, \t`category`.`title` AS `category_title`, \t`category`.`ordering` AS `category_ordering`, \t`category`.`params` AS `category_params` FROM `ww_flower` AS `flower` \tLEFT JOIN `ww_categories` AS `category` ON flower.catid = category.id WHERE `flower`.`state` = 1 \tAND `category`.`id` >= 2 ORDER BY flower.title DESC LIMIT 1, 3 SQL; $this->assertEquals($dataset, $this->loadToDataset($sql)); }