我在PHPUnit中模拟对象有问题:
class FootballTest extends PHPUnit_Framework_TestCase
{
/**
* @var Football
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->siteName = 'football';
$this->footballAPIMock = $this->getMock('FootballAPI');
$this->object = new Football($this->siteName,$this->footballAPIMock);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
$this->object = null;
}
public function testGetByTeamOutrights()
{
$markets = 5;
$this->footballAPIMock->expects($this->any())
->method('getByTeamOutrights')
->with($this->equalTo(5))
->will($this->returnValue(5));
$this->assertNull($this->object->getByTeamOutrights(5));
}
}
我正在失败宣称足球对象
PHPUnit版本3.6.12