这是我的测试代码:
public function testTransceiverEntityCreate()
{
$transceiver_driver = Mockery::mock('Recoder\Drivers\TransceiverDriverInterface');
$transceiver_driver->shouldReceive('load');
$transceiver_utils = Mockery::mock('TransceiverUtils');
new Transceiver('1F2D03', $transceiver_utils, $transceiver_driver);
}当我运行测试时,它会返回以下错误:
1) TransceiverTest::testTransceiverEntityCreate Argument 2 passed to Recoder\Entities\Transceiver::__construct() must be an instance of Recoder\TransceiverUtils, instance of Mockery_2__TransceiverUtils given, called in /var/www/solidoptics-recorder/private/application/libraries/Recoder/tests/Entities/TransceiverTest.php on line 35 and defined
为什么是Mockery_2__TransceiverUtils?任何想法我都会很高兴的。谢谢。
发布于 2014-06-17 16:28:18
当找不到类时,就会发生这种情况,所以嘲弄类完全是在模仿类,而不是扩展类。类必须已经加载,或者可以通过自动加载加载。
https://stackoverflow.com/questions/24267819
复制相似问题