phpunit command doesn't work for laravel 4 on windows 7 phpunit command doesn't work for laravel 4 on windows 7 laravel laravel

phpunit command doesn't work for laravel 4 on windows 7


The solution for me:

php vendor/phpunit/phpunit/phpunit

This, of course, assumes you've set up a php environment variable in Windows


As Unnawut said, it doesn't work because vendor/phpunit/phpunit/phpunit is not a native Windows executable. You need a .bat or .cmd file that will basically call 'php phpunit'. There should be one in vendor/bin, but to make life easy, try this - create a file phpunit.bat (or .cmd) at the root of your site, containing this:

@ECHO OFFSET BIN_TARGET=%~dp0/vendor/phpunit/phpunit/phpunitphp "%BIN_TARGET%" %*

Now you can call phpunit from the command line at the root of the site.


If you are a window user and you are having this issue, do this:

You need to tell Window where to find PHPUnit command, you can first of all verify that this file exists in your Laravel project under /vendor/bin

enter image description here

Finally you need to append the full path to /vendor/bin in your window PATH variable,

To do this:1. Right-click on 'Computer' then click properties

enter image description here

  1. On the second window click Advanced system settings

enter image description here

  1. On the next window under Advanced click Environmental Variables

enter image description here

  1. On the next window double-click PATH then set PATH variable by appending

the full path to your laravel-project/vendor/bin; Notice the ; at the end.

NB: Other variables might already exists in the PATH, so ensure you don't overwrite them by appending your own at the very end

  1. Finally click Ok on all the dialog boxes

enter image description here