9

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

Maryadi Poipo
  • 1,418
  • 8
  • 31
  • 54

2 Answers2

25

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
tersakyan
  • 773
  • 6
  • 15
1

Just install phpunit through composer:

composer global require phpunit/phpunit

then all you are set to test your laravel project.

curiosity
  • 834
  • 8
  • 20