Show more details about errors in PHPUnit#454
Conversation
7d6b6a7 to
89e25b7
Compare
b312f48 to
855487c
Compare
phpunit.xml.dist
Outdated
| beStrictAboutOutputDuringTests="true" | ||
| displayDetailsOnPhpunitDeprecations="true" | ||
| displayDetailsOnTestsThatTriggerDeprecations="true" | ||
| displayDetailsOnTestsThatTriggerErrors="true" |
There was a problem hiding this comment.
Regarding displayDetailsOnTestsThatTriggerErrors: what's the difference between having it and the default behavior?
There was a problem hiding this comment.
@GromNaN I tried throw \Error inside a test, and couldn't find a difference with or without this setting, so let's remove it?
There was a problem hiding this comment.
The different is with trigger_error('Hello World', E_USER_ERROR).
PHPUnit 12.4.1 by Sebastian Bergmann and contributors.
Runtime: PHP 8.4.8
Configuration: /Users/jerome/Develop/doctrine-persistence/phpunit.xml.dist
E 1 / 1 (100%)
Time: 00:00.006, Memory: 16.00 MB
There was 1 error:
1) ErrorTest::testError
E_USER_ERROR was triggered
tests/ErrorTest.php:9
+ --
+
+ 1 test triggered 1 error:
+
+ 1) tests/ErrorTest.php:9
+ Hello World
+
ERRORS!
Tests: 1, Assertions: 0, Errors: 2, Deprecations: 1.There was a problem hiding this comment.
Ah nice! I guess it could be useful to have the "Hello World" part.
There was a problem hiding this comment.
This was my test:
<?php
use PHPUnit\Framework\TestCase;
class ErrorTest extends TestCase
{
public function testError(): void
{
trigger_error('Hello World', E_USER_ERROR);
}
}855487c to
22dfdbe
Compare
|
We get deprecation with PHP 8.1, without message |
|
When the job uses lowest dependencies, PHPUnit should probably be instructed to not fail when detecting deprecations using the |
7fcb327 to
2a773aa
Compare
d5a7a1d to
5569ecd
Compare
5569ecd to
6e1cf15
Compare
|
I updated the Action. PR is ready. |
Extracted from #450 (comment)