当我使用@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任何可能的'推'无法找到? –