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