function testReadOne() { $mock = $this->getMock('TikiDb'); $query = 'SELECT `user` FROM `tiki_user_watches` WHERE 1=1 AND `watchId` = ?'; $mock->expects($this->once())->method('fetchAll')->with($this->equalTo($query), $this->equalTo(array(42)), $this->equalTo(1), $this->equalTo(0))->will($this->returnValue(array(array('user' => 'hello')))); $table = new TikiDb_Table($mock, 'tiki_user_watches'); $this->assertEquals('hello', $table->fetchOne('user', array('watchId' => 42))); }