我是单元测试的新手(并且非常想学习)。我试图拉下这个存储库(https://github.com/serbanghita/Mobile-Detect)并一直在尝试运行他们已经设置的单元测试。我已经到了phpunit正在运行但我运行
的时候phpunit tests
从我得到的根目录:
Tests: 1411, Assertions: 0, Errors: 1411
我试过了
phpunit --configuration tests/phpunit.xml
然后我收到错误:
Class "JohnKary\PHPUnit\Listener\SpeedTrapListener" does not exist
他们的文档中有关于运行的内容:
php phpunit.phar -c tests/phpunit.xml
但我收到了错误
Could not open input file: phpunit.phar
这是因为我设置phpunit的方式我确定......
有关如何进一步解决这个问题的任何建议吗?
答案 0 :(得分:2)
您似乎已将https://github.com/johnkary/phpunit-speedtrap配置为在phpunit.xml
中用作测试用户,但尚未(正确)安装此扩展程序。
如果您的PHP找不到phpunit.phar
,那么您要么没有将其指向正确的路径,要么您没有下载/安装PHPUnit PHAR,可能是因为您选择通过Composer安装PHPUnit。在这种情况下,正确的路径当然是vendor/bin/phpunit
。