miguelbgouveia miguelbgouveia - 2 months ago 13
PHP Question

Can't run phpunit tests from command line

I am trying to run unit tests in a new laravel 5 application, using the phpunit framework. In the root path of my laravel application I ru the following command:

./vendor/bin/phpunit /tests/ExampleTest.php

And then I get the following message:

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

I already have composer installed in may system and I install Laravel 5 using composer. Isn't phpunit installed when I install a new laravel 5 application? If not, how can I install it in a existent laravel 5 application?

I known that I can also install phpunit globaly and resolve the problem. But maybe it will be a duplication since I have all the phpunit code already in may laravel application.


You need to have Composer installed and run composer install or composer update in your application to install the different packages listed in your composer.json.

When you install your Laravel application it doesn't install the packages right away.

You can verify the packages are installed by looking in the vendor directory of your application and check that phpunit is in there.