Sreenath
Sreenath

Reputation: 143

Executing phpunit test in laravel

When I run phpunit tests in Laravel using /vendor/bin/phpunit the tests are executed and the results are generated. I am also able to do tests on a single file with /vendor/bin/phpunit </tests/<filename>

However, when I execute the following command it fails:

./vendor/bin/phpunit ./

Fatal error: Class 'Codeception\Module\OrderHelper' not found in /vendor/codeception/codeception/tests/data/claypit/tests/order/ParsedLoadedTest.php on line 2

But I could see that the OrderHelper file still exist.

<project-folder>/vendor/codeception/codeception/tests/data/claypit/tests/_support/OrderHelper.php

Can anyone help me in this?

Upvotes: 1

Views: 718

Answers (2)

Mohamed Bouallegue
Mohamed Bouallegue

Reputation: 1362

The directory passed to phpunit should be the directory where the tests are. So just change it to ./vendor/bin/phpunit ./tests and it should work fine.

Upvotes: 2

balasubramani
balasubramani

Reputation: 19

No need to point the directory.. try to do this. it may help you.
Bulk File

vendor/bin/phpunit

Single File

vendor/bin/phpunit <fileName>

Upvotes: 0

Related Questions