Reputation: 3197
I have installed phpunit in this instance of laravel using composer. The files are present in the laravel/vendor/bin folder. when I run vendor/bin/phpunit the example test runs. In all the tutorials I am watching on unit testing in laravel the tutors simply run phpunit and it runs the test.
In the laravel documentation it says that I should be able to simply run phpunit to initiate the tests.
Is the documentation refering to phpunit being installed system wide and do the tutors in the video simply have it installed system wide or am I missing something?
Upvotes: 3
Views: 2603
Reputation: 8162
In Mac OS, just go to your Laravel project directory via Terminal and then enter this command:
alias phpunit="~/Your Project Directory Name/vendor/bin/phpunit"
From now on you can run PHPUnit by just simply typing phpunit
.
Upvotes: 0
Reputation: 103
In linux, get phpunit path by typing which phpunit
in the terminal. Its probably in the /usr/bin/ dir. execute
alias phpunit='/usr/bin/phpunit'
in the terminal.
Upvotes: 6
Reputation: 33068
They have it installed system wide.
If you are in Windows, you can modify your PATH system variable to include the path to phpunit. For example on mine, I've appended ;C:\wamp\www\rel\vendor\bin
to it.
Then you'd just have to navigate to the folder your project is in which should have the phpunit.xml
file that was included with laravel and run phpunit
on your command prompt.
Unfortunately, I am not completely sure how to do this on Linux or OSX.
Upvotes: 2