public function testGetRecordByID() { //Query Stubbing $queryStub = $this->getMock('MockPdoStatement', array('execute', 'fetch')); $queryStub->expects($this->once())->method('execute')->will($this->returnSelf()); $queryStub->expects($this->once())->method('fetch')->will($this->returnValue(array('id' => 1, 'username' => 'baptiste'))); //PDO stubbing $pdoStub = $this->getMock('\\RjakesTest\\FmPdo\\MockPdo', array('prepare')); $pdoStub->expects($this->once())->method('prepare')->with($this->equalTo("SELECT * FROM users WHERE id='1' LIMIT 1;"))->will($this->returnValue($queryStub)); $this->fmPdo->setConnection($pdoStub); $this->assertInstanceOf('\\Rjakes\\FmPdo\\Record', $this->fmPdo->getRecordByID('users', 1)); }