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));
}
}
そして、その Football オブジェクトをアサートする Fail を取得しています
PHPUnit バージョン 3.6.12