/** * test group to generate GROUP BY statements on virtual fields * * @return void */ public function testVirtualFieldsInGroup() { $Article = ClassRegistry::init('Article'); $Article->virtualFields = array('this_year' => 'YEAR(Article.created)'); $result = $this->Dbo->group('this_year', $Article); $expected = " GROUP BY (YEAR(`Article`.`created`))"; $this->assertEquals($expected, $result); }
/** * test group to generate GROUP BY statements on virtual fields * * @return void */ public function testVirtualFieldsInGroup() { $Boat = ClassRegistry::init('Boat'); $Boat->virtualFields = array('this_year' => 'YEAR(Boat.created)'); $result = $this->Dbo->group('this_year', $Boat); $expected = " GROUP BY (YEAR(`Boat`.`created`))"; $this->assertEquals($expected, $result); }