【问题标题】:phpunit tests returning no assertions and all errorsphpunit 测试不返回任何断言和所有错误
【发布时间】:2016-10-18 02:44:14
【问题描述】:

我是单元测试的新手(并且非常想学习)。我尝试拉下这个存储库 (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 的设置方式...

关于如何进一步解决此问题的任何建议?

【问题讨论】:

    标签: unit-testing phpunit


    【解决方案1】:

    您似乎已将 https://github.com/johnkary/phpunit-speedtrap 配置为在您的 phpunit.xml 中用作测试侦听器,但尚未(正确)安装此扩展程序。

    如果您的 PHP 找不到 phpunit.phar,那么您要么没有将其指向正确的路径,要么您没有下载/安装 PHPUnit PHAR,可能是因为您选择通过 Composer 安装 PHPUnit。在这种情况下,正确的路径当然是vendor/bin/phpunit

    【讨论】:

      猜你喜欢
      • 2016-07-08
      • 2016-05-03
      • 2022-01-24
      • 2018-04-06
      • 2013-06-20
      • 2021-04-20
      • 2013-02-02
      • 1970-01-01
      • 2013-09-15
      相关资源
      最近更新 更多