Laravel 5 phpunit 不是 运行 测试
Laravel 5 phpunit is not running tests
我已经这样做了好几天了,但没有成功。 运行Laravel 5.1
。
据我了解,根据 Laravel
文档。
An ExampleTest.php file is provided in the tests directory. After installing a new Laravel application, simply run phpunit on the command line to run your tests.
好的,所以在 运行ning phpunit
之后,我发现它不是全局安装的,而是位于 vendor/bin/phpunit
。继续 运行 vendor/bin/phpunit
给我一个屏幕,其中包含 phpunit 的所有命令选项。它实际上 运行 没有任何测试。
我进行了更多搜索,发现 post that mentioned it could be a symlink
issue. I followed the instructions in the post 但没有成功。根据我的记忆,我从 composer 安装了 Laravel
,所以 symlink
应该不是问题。
这些说明涉及删除各种文件。我确实注意到作曲家在更新时正在从其缓存中提取文件。所以我清除了它的缓存并再次执行了该过程。仍然没有成功。
哪些测试不是 运行ning?我束手无策。特别是因为它应该 运行 很容易开箱即用。
您需要全局安装phpunit:
composer global require phpunit/phpunit
然后您可以从您的项目根目录 运行 phpunit
。
最后我没有正确调用bat文件。我当时 运行宁
C:\localhost\myProject\vendor\bin> phpunit
相反,我需要 运行
C:\localhost\myproject> call vendor\bin\phpunit
因此它现在正在引用带有测试位置信息的 phpunit.xml
文件。
您可以 运行 项目附带的 phpunit,只需转到您的项目根目录并 运行 ./vendor/bin/phpunit
,这样测试就会按应有的方式执行如果失败,您可以获得反馈。
出于某种原因,我还没有弄清楚如果您在计算机中全局安装 phpunit,您将不会收到测试反馈。
我已经这样做了好几天了,但没有成功。 运行Laravel 5.1
。
据我了解,根据 Laravel
文档。
An ExampleTest.php file is provided in the tests directory. After installing a new Laravel application, simply run phpunit on the command line to run your tests.
好的,所以在 运行ning phpunit
之后,我发现它不是全局安装的,而是位于 vendor/bin/phpunit
。继续 运行 vendor/bin/phpunit
给我一个屏幕,其中包含 phpunit 的所有命令选项。它实际上 运行 没有任何测试。
我进行了更多搜索,发现 post that mentioned it could be a symlink
issue. I followed the instructions in the post 但没有成功。根据我的记忆,我从 composer 安装了 Laravel
,所以 symlink
应该不是问题。
这些说明涉及删除各种文件。我确实注意到作曲家在更新时正在从其缓存中提取文件。所以我清除了它的缓存并再次执行了该过程。仍然没有成功。
哪些测试不是 运行ning?我束手无策。特别是因为它应该 运行 很容易开箱即用。
您需要全局安装phpunit:
composer global require phpunit/phpunit
然后您可以从您的项目根目录 运行 phpunit
。
最后我没有正确调用bat文件。我当时 运行宁
C:\localhost\myProject\vendor\bin> phpunit
相反,我需要 运行
C:\localhost\myproject> call vendor\bin\phpunit
因此它现在正在引用带有测试位置信息的 phpunit.xml
文件。
您可以 运行 项目附带的 phpunit,只需转到您的项目根目录并 运行 ./vendor/bin/phpunit
,这样测试就会按应有的方式执行如果失败,您可以获得反馈。
出于某种原因,我还没有弄清楚如果您在计算机中全局安装 phpunit,您将不会收到测试反馈。