Rahimi0151
Rahimi0151

Reputation: 411

phpunit not working on a fresh installation of laravel 5.7

I'm having a problem with my freshly installed Laravel.

when I'm trying to use phpunit command to run default ExampleTest.php , I got this error :

D:\Laravel\Rahimi0151>phpunit
PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in C:\xampp\php\pear\PHPUnit\TextUI\Command.php on line 277

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in C:\xampp\php\pear\PHPUnit\TextUI\Command.php on line 277
PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in C:\xampp\php\pear\PHPUnit\TextUI\Command.php on line 285

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in C:\xampp\php\pear\PHPUnit\TextUI\Command.php on line 285
PHPUnit 3.7.21 by Sebastian Bergmann.

Configuration read from D:\Laravel\Rahimi0151\phpunit.xml



Time: 0 seconds, Memory: 4.00Mb

[30;43m[2KNo tests executed!
[0m[2K

and at the bottom, it says :

No tests executed!

Can someone please help me with a solution?

Upvotes: 3

Views: 3647

Answers (3)

dulerong
dulerong

Reputation: 289

Running Lumen version 7.0, and was instructed to simply run phpunit

However running phpunit always produced No Test Executed error.

Tried Admir Husić's advice, ran php vendor/phpunit/phpunit/phpunit, and problem solved, Lumen found the test file and executed it.

Thanks.

Upvotes: -1

Admir Husić
Admir Husić

Reputation: 61

In case somebody is searching for the answer here it is:

php vendor/phpunit/phpunit/phpunit

and make sure that your function contains the word "test"

for example

public function test_a_user_can_browse_threads()
{
...
}

edit: this works for laravel version 7

Upvotes: -1

Marcin Nabiałek
Marcin Nabiałek

Reputation: 111829

The problem here is that you are running PHPUnit installed on your system that is pretty old and not PHPUnit that should be run for this project.

To make sure you run the PHPUnit that is really installed for this project you should rather run:

vendor/bin/phpunit

or

vendor/bin/phpunit.bat

Upvotes: 12

Related Questions