Warm tip: This article is reproduced from serverfault.com, please click

Can't run phpunit tests from command line

发布于 2015-06-01 16:05:57

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.

Questioner
miguelbgouveia
Viewed
0
Jeremy D 2015-06-02 23:16:23

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.