/** * test hasAny() * * @return void */ public function testHasAny() { $this->Dbo = $this->getMock('Mysql', array('connect', '_execute', 'execute', 'value')); $this->Model = $this->getMock('TestModel', array('getDataSource')); $this->Model->expects($this->any())->method('getDataSource')->will($this->returnValue($this->Dbo)); $this->Dbo->expects($this->at(0))->method('value')->with('harry')->will($this->returnValue("'harry'")); $this->Dbo->expects($this->at(1))->method('execute')->with('SELECT COUNT(`TestModel`.`id`) AS count FROM `test_models` AS `TestModel` WHERE `TestModel`.`name` = \'harry\''); $this->Dbo->expects($this->at(2))->method('execute')->with('SELECT COUNT(`TestModel`.`id`) AS count FROM `test_models` AS `TestModel` WHERE 1 = 1'); $this->Dbo->hasAny($this->Model, array('TestModel.name' => 'harry')); $this->Dbo->hasAny($this->Model, array()); }