Reputation: 223
Hi i am quit new in Laravel PHPUnit, getting the following error :
Laravel : phpunit cannot open file ExampleTest.php
I don't have idea why i am getting this error. I installed PHPUnit globally and when i run "phpunit" in terminal it runs fine. But I want to run it on specific file like :
phpunit ExampleTest
Thanks In Advance.
Upvotes: 6
Views: 8768
Reputation: 618
Maybe you call wrong to your test. Try like this :
php artisan test --filter YourTestClassName
Upvotes: 0
Reputation: 356
This started happening when I upgrade phpUnit, I had to update phpStorm to fix it.
Upvotes: 1
Reputation: 439
try it like this:
vendor\bin\phpunit tests\Unit\ExampleTest.php
it will work surly but first install phpunit globally.
Upvotes: 0
Reputation: 36
I am working in Windows. Try to use the full path:
C:\Desktop\code\blog\vendor\bin>phpunit C:\Desktop\code\blog\tests\Feature\ExampleTest.php
PHPUnit 7.2.6 by Sebastian Bergmann and contributors.
. 1 / 1 (100%)
Time: 1.46 seconds, Memory: 10.00MB
OK (1 test, 1 assertion)
Upvotes: 2
Reputation: 2211
Make sure you are on the project root and referencing the file inside the tests folder.
Example:
phpunit tests/ExampleTest.php
Upvotes: 5