public function testNumRowsMethod() { $database = $this->getMockBuilder('\\DatabaseBase')->disableOriginalConstructor()->setMethods(array('numRows'))->getMockForAbstractClass(); $database->expects($this->once())->method('numRows')->with($this->equalTo('Fuyu'))->will($this->returnValue(1)); $connectionProvider = $this->getMockBuilder('\\SMW\\DBConnectionProvider')->disableOriginalConstructor()->getMock(); $connectionProvider->expects($this->atLeastOnce())->method('getConnection')->will($this->returnValue($database)); $instance = new Database($connectionProvider); $this->assertEquals(1, $instance->numRows('Fuyu')); }