Dimitrios Desyllas
Dimitrios Desyllas

Reputation: 10028

How I can make phpunit which test executes now?

When I run phpunit unit tests it shows the ouput in a format like:

PHPUnit 7.5.13 by Sebastian Bergmann and contributors.

.............F.................EEEEEEE.......E.................  63 / 271 ( 23%)
.........EFE.............

But I want to know what test exactly is running instead of showing the . when indicating the current test running. For example a list like:

Executing `Tests\App\Mytest.php:test something........[SUCESS] 5s
Executing `Tests\App\Anothertest.php:test something........[FAILED] 5s

So how I can change the phpunit's output showing the current test running?

Upvotes: 1

Views: 101

Answers (1)

user8034901
user8034901

Reputation:

If you can live with the duration not being displayed you can use the --debug command-line option to show debug information:

phpunit --debug

This will return output similar to:

PHPUnit 8.4.2 by Sebastian Bergmann and contributors.
Test 'Tests\Unit\ExampleTest::testBasicTest' started
Test 'Tests\Unit\ExampleTest::testBasicTest' ended
Test 'Tests\Feature\PagesTest::usersCanSeeTheWelcomePage' started
Test 'Tests\Feature\PagesTest::usersCanSeeTheWelcomePage' ended

Time: 200 ms, Memory: 24.00 MB
There was 1 failure:
1) Tests\Feature\PagesTest::usersCanSeeTheWelcomePage
Expected status code 200 but received 404.
Failed asserting that false is true.
[...]
FAILURES!
Tests: 4, Assertions: 4, Failures: 1.

Upvotes: 2

Related Questions