try
./vendor/bin/phpunit
from the project root
You can also alias phpunit
alias phpunit="/{pathtoproject}/vendor/bin/phpunit"
If you are a windows user then you should try executing command from your laravel project root directory as below,
laravel-project>vendor\bin\phpunit
Also, check in your bin directory that, phpunit.bat file is exist or not as i think in latest version it is not available so you need to import the dependencies for that.
i'm mac user. But i found where is my problem. i'm a beginner in testing, and i was thinking that phpunit was include in laravel, i didn't know i had to install it.
Thank you
The documentation is a bit misleading, assuming that you already have phpunit installed.
I ran into this today. I don't know what changed, I was able to run phpunit from my project root just a couple days ago and now suddenly I'm getting "phpunit: command not found"
With the friendly help from IRC, the solution for me was:
composer global require phpunit/phpunit
And making sure that I had "export PATH=$PATH:~/.composer/vendor/bin" in my .bash_profile
just cd inside app folder for laravel and alias phpunit="vendor/bin/phpunit"
NMaaruf said:
just cd inside app folder for laravel and alias phpunit="vendor/bin/phpunit"
I've tried a lot of other people's solutions and it seems that yours was the only one to work, thank you very much :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community