3
votes

I'm new to Lumen (and Laravel). I've created a project with Composer and now I'm trying to get PHPUnit to work.

I'm following a book, where it should be possible to run a default passing test by typing vendor/bin/phpunit in the terminal, but it gives the error:

'vendor' is not recognized as an internal or external command, operable program or batch file

I've checked that the phpunit file is actually there and that phpunit is added as dependency in my composer.json file. I've also tried ./vendor/bin/phpunit and vendor/bin/phpunit/phpunit, but with the same result.

I've searched Google to find a solution, but everyone else seem to have issues when running phpunit (wihout vendor/bin) and the solution is to use the full path vendor/bin/phpunit, but since I'm already doing that, it does not fix my problem.

I'm using PHPStorm on a Windows machine and running the PHP server via PHPStorm. I've not modified the default Lumen project.

Any help is greatly appreciated!

UPDATE:

Trying php vendor/bin/phpunit gives the following error:

You need to set up the project dependencies using the following commands:
wget http://getcomposer.org/composer.phar
php composer.phar install

I'm not sure what that means, since I've already installed Composer. I used Composer to create the project and I haven't changed the dependencies from the default.

3

3 Answers

7
votes

I had the same problem, for Windows it's vendor\bin\phpunit ;)

7
votes

It turned out that some symlinks and permissions were not installed properly in the default project. I tried deleting the entire vendor/ directory and run composer install.

Now I can run phpunit with the command vendor\bin\phpunit (because I'm running on Windows - thanks Nizarii)

2
votes

try this:

php vendor/bin/phpunit