當我使用@depends(在Yii2中)編寫phpunit測試用例時,這個帶有@depends的測試用例將被跳過。似乎函數依賴於找不到。 下面是代碼:PHPUnit @depends annoation不起作用
測試用例代碼:
E:\xampp_5_5_32\php\php.exe C:/Users/huzl/AppData/Local/Temp/ide-phpunit.php --bootstrap E:\MIC\vagrant\rental\frontend\tests\_bootstrap.php --no-configuration --filter "/::testPush(.*)?$/" frontend\tests\example\GoodsServiceTest E:\MIC\vagrant\rental\frontend\tests\example\GoodsServiceTest.php
Testing started at 15:35 ...
PHPUnit 4.8.27 by Sebastian Bergmann and contributors.
This test depends on "frontend\tests\example\GoodsServiceTest::pull" to pass.
Time: 430 ms, Memory: 4.50MB
No tests executed!
Process finished with exit code 0
誰能幫助:
class GoodsServiceTest extends \PHPUnit_Framework_TestCase
{
private $service;
public function pull(){
return [1,2];
}
/**
* @depends pull
*/
public function testPush($stack){
$this->assertEquals([1,2],$stack);
}
}
不應該'拉'需要有一個斷言通過?當'testPush'取決於'push','push'它自己需要成功才執行'testPush' – masterFly
將你的圖片替換成你的代碼和錯誤 –
@masterFly我這麼認爲,但我不知道why.Is任何可能的'推'無法找到? –