I have installed PHPunit
using composer
. The application has unit test cases. from my project folder when i do a "phpunit
" it gives me an error saying phpunit
not found..but if i do a "./vendor/bin/phpunit"
it will work. Any idea how to fix this ?
Asked
Active
Viewed 119 times
0

Saurabh Chandra Patel
- 12,712
- 6
- 88
- 78

vinay
- 15
- 3
-
[Here][1] Is an other Question which can help you [1]: http://stackoverflow.com/questions/4091862/getting-phpunit-working-include-path-not-set-correctly – Saurabh Chandra Patel Aug 01 '13 at 07:11
2 Answers
0
You need to add PHPUnit to your path. Include the ./vendor/bin/phpunit into your PATH environment (to be searched when looking for programs) in your OS.

Steven Scott
- 10,234
- 9
- 69
- 117
-
It should not have to be. You would have 1 PHPUnit, and test all your projects with it. Relative paths may still be added to your PATH environment, if needed. Also, I believe you can add PHPUnit to the include path in the Bootstrap.php file, in case you want to use that method. – Steven Scott Aug 01 '13 at 19:24
0
I had the same problem and got tired of fiddling with PATHs on all my machines, so I wrote a small tool that makes composer behave a bit more like PEAR did:
https://github.com/flack/poser
You can use it to install Composer packages globally by running:
poser require phpunit/phpunit
Afterwards, calling phpunit
on the shell will work as expected.

user2792352
- 139
- 7