鍍金池/ 問答/PHP/ laravel中 只能用vendor/bin/phpunit ?

laravel中 只能用vendor/bin/phpunit ?

在laravel5.1項目根目錄 執(zhí)行phpunit 提示

PHPUnit 6.3.1 by Sebastian Bergmann and contributors.



Time: 77 ms, Memory: 10.00MB

No tests executed!

執(zhí)行vendor/bin/phpunit 一切正常

PHPUnit 4.8.30 by Sebastian Bergmann and contributors.

...

Time: 1.91 seconds, Memory: 14.00MB

OK (3 tests, 148 assertions)

在5.1項目在本地運行的情況下
我又在5.3 和5.5中也都執(zhí)行了phpunit
5.3也是提示不能運行 5.5可以正常測試

所有的項目下執(zhí)行vendor/bin/phpunit都可以正常測試

默認配置文件phpunit.xml沒動過
不知道有沒有遇到這樣問題的朋友 想問下是什么原因

回答
編輯回答
挽青絲

phpunit版本問題,laravel 5.3依賴phpunit 5,laravel 5.5 依賴phpunit 6,所以進行以下操作

  • 清理舊版本phpunit,使用composer global remove phpunit/phpunit
  • 安裝新版本phpunit,使用composer global require phpunit/phpunit ^6.2
2018年6月9日 06:02