/** * Tests to ensure that the Query Mocker is used to execute a query. */ public function testExecuteMocker() { $mocker = new QueryMocker(); $mocker->setResult(true); QueryType::setMocker($mocker); $this->assertInstanceOf('\\Queryer\\Mock\\QueryMockerResult', $this->queryType->execute()); }
/** * Tests to ensure that the execute method throws a QueryMockerResultException when there aren't enough results. * * @expectedException \Queryer\Exception\QueryMockerResultException * @expectedExceptionCode \Queryer\Exception\QueryMockerResultException::NOT_ENOUGH_RESULTS */ public function testAddResultNotExpectingException() { $this->queryMocker->addResult(true); $this->queryMocker->execute(array()); // This should result in an Exception. $this->queryMocker->execute(array()); }