Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run phpunit in laravel 5.5

I have a problem running phpunit in my laravel 5.5. I already go to vendor/bin and then execute phpunit using my command prompt in windows. But cmd just give another option or flag as shown in the picture below : enter image description here

I have read laravel 5.5 documentation for unittest. It's said that we just need to execute phpunit {as shown in https://laravel.com/docs/5.5/testing} Then I tried this : How to run single test method with phpunit?

phpunit --filter testBasicTest tests\Unit\ExampleTest

As shown below : enter image description here

BUt it's said that 'cannot open the file'. Then I Tried phpunit ExampleTest, but still cannot open the file. So what's wrong here...? Thanks in advance

Note : Here's my phpunit.xml : enter image description here

like image 477
Maryadi Poipo Avatar asked Oct 30 '17 07:10

Maryadi Poipo


1 Answers

You need to run phpunit without getting inside the bin folder.

Try this:

vendor/bin/phpunit

This will load your phpunit.xml file. Otherwise it cannot load your configuration file. Unless if you don't give spesific path:

vendor/bin/phpunit --configuration /path/to/laravels/phpunit.xml
like image 111
tersakyan Avatar answered Sep 27 '22 16:09

tersakyan