0
我试图在调用一个模拟对象时传递一个对象。像这样:用PHPUnit的模拟对象传递类型对象的参数
public function testGetMedia()
{
$getPrimaryMediaHelper = $this->getMock('GetPrimaryMediaHelper', array('getMedia'));
$getPrimaryMediaHelper->expects($this->any())
->method('getMedia')
->with($media1, 'test');
}
第一个参数需要是对象类型,否则测试将失败。我怎样才能将$ media模拟为类型对象?
在此先感谢。
也做到了,谢谢! – brainmonger 2012-07-18 04:03:33