Closed
Description
Q | A |
---|---|
PHPUnit version | 10.4.2 |
PHP version | 8.2.12 |
Installation Method | Composer |
Summary
the following test code:
<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
class Test extends TestCase
{
public function testUserWarning(): void
{
trigger_error('x', \E_USER_WARNING);
self::assertTrue(true);
}
public function testUserError(): void
{
trigger_error('x', \E_USER_ERROR);
self::assertTrue(true);
}
public function testRisky(): void
{
}
}
Current behavior
is outputing:
PHPUnit 10.4.2 by Sebastian Bergmann and contributors.
Runtime: PHP 8.2.12
Configuration: /path.../prefix-phpunit.xml.dist
W.R 3 / 3 (100%)
Time: 00:00.018, Memory: 6.00 MB
There was 1 risky test:
1) Ns...\Test::testRisky
This test did not perform any assertions
/path.../Test.php:25
--
1 test triggered 1 error:
1) /path.../Test.php:21
x
Triggered by:
* Ns...\Test::testUserError
/path.../Test.php:19
--
1 test triggered 1 warning:
1) /path.../Test.php:15
x
Triggered by:
* Ns...\Test::testUserWarning
/path.../Test.php:13
OK, but there were issues!
Tests: 3, Assertions: 2, Errors: 1, Warnings: 1, Risky: 1.
How to reproduce
run phpunit with --fail-on-warning --fail-on-risky --fail-on-notice --fail-on-deprecation --display-notices --display-deprecations --display-warnings --display-errors --display-incomplete --display-skipped
(display all and fail on all)
Expected behavior
same as above with the following diff:
...
Configuration: /path.../prefix-phpunit.xml.dist
-W.R 3 / 3 (100%)
+WER 3 / 3 (100%)
Time: 00:00.018, Memory: 6.00 MB
...
(the exit code and the verbose output (thanks to --display-warnings --display-errors
) is fine already)
Any warning must not be displayed as .
(dot).