How to make PHPUnit output errors?
Asked Answered
A

1

1

I'm running PHPUnit from the command line in windows as follows:

 php phpunit.phar --bootstrap .\commonTests\bootstrap_local.php .\commonTests\DIContainerTest.php --testdox --stderr -v

and I'm getting this result:

PHPUnit 10.1.2 by Sebastian Bergmann and contributors.

Runtime: PHP 8.2.0

E

Time: 00:00.004, Memory: 24.00 MB

ERRORS! Tests: 1, Assertions: 0, Errors: 1.

How do I make it output the error messages? As you can see I've tried a number of flags but it's still leaving me in the dark. I've also tried --verbose and --debug but it says neither of those are supported

I tried creating a file phpunit.xml where I run the test:

<phpunit>
    <php>
        <ini name="error_reporting" value="E_ALL" />
        <ini name="display_errors" value="1" />
        <ini name="display_startup_errors" value="1" />
    </php>
</phpunit>

But it had no effect.

I also tried adding this to the beginning of the Test class file:

ini_set('error_reporting', E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');

But it had no effect either.

Please help!! Thanks

Ailsa answered 9/5, 2023 at 7:49 Comment(0)
W
0

It looks like the only option is to remove the --testdox flag.

Welby answered 18/10, 2023 at 16:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.