-
-
Couldn't load subscription status.
- Fork 73
Show more details about errors in PHPUnit #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding displayDetailsOnTestsThatTriggerErrors: what's the difference between having it and the default behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice! I guess it could be useful to have the "Hello World" part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Extracted from #450 (comment)