我在我的 laravel 5.5 中运行 phpunit 时遇到问题。我已经转到 vendor/bin,然后在 Windows 中使用我的命令提示符执行 phpunit。但是 cmd 只是给出另一个选项或标志,如下图所示:
我已经阅读了单元测试的 laravel 5.5 文档。据说我们只需要执行phpunit {如图https://laravel.com/docs/5.5/testing } 然后我试了这个: How to run single test method with phpunit?
phpunit --filter testBasicTest tests\Unit\ExampleTest
但是它说“无法打开文件”。然后我试了 phpunit ExampleTest,但仍然无法打开文件。那么这里有什么问题......? 提前致谢
最佳答案
您需要在不进入 bin 文件夹的情况下运行 phpunit。
试试这个:
vendor/bin/phpunit
这将加载您的 phpunit.xml
文件。否则它无法加载您的配置文件。除非您不提供特定路径:
vendor/bin/phpunit --configuration /path/to/laravels/phpunit.xml
关于php - 如何在 laravel 5.5 中运行 phpunit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47009667/