-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Deprecations not reported in the summary when running all unit tests #5793
Comments
Thank you for your report. Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting. Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue. |
Example unit test:
|
I cannot reproduce this:
The deprecation is correctly reported. |
Interesting. I don't know if it matters, but I am doing this with the Laravel sail 8.2 image and have also tried this with the php8.2-cli image. Is there a particular php.ini setting that might dictate if the deprecations are shown? |
Sure: |
Sigh...of course they have it set to At this point, it's clearly something with the configuration of Laravel/php/my code that is overriding what I expect to happen. So I appreciate you pointing me at what l needed to look at. Thanks! |
Summary
While upgrading my application from PHP 8.1 to 8.2, I was validating that the code and unit tests had no issues and no deprecation issues. When I ran the unit tests, I saw output that there was a deprecation, but the summary just reported OK. If I ran the individual unit test, the summary reports the deprecation.
Current behavior
When I ran the unit tests, I saw this in the output:
Deprecated: Creation of dynamic property Tests\Unit\Dashboards\PrefillDateArrayTest::$defaultArrayItem is deprecated in /app/tests/Unit/Dashboards/PrefillDateArrayTest.php on line 15
But the summary was
OK (97 tests, 214 assertions)
.This even happens if I use
--display-deprecations
, it does not report the deprecations in the summary.If I run the individual unit test, I got this:
How to reproduce
Have the phpunit.xml set to report deprecations(my configuration below) and have a unit test that triggers a depcreation warning(like using a dynamic property on a class that isn't defined). Run the unit tests and see the warning, but not mentioned in the summary. Then run just the unit test and see that the summary reports it.
Expected behavior
Deprecations are reported if the different deprecation settings in phpunit.xml are specified as true or
--display-deprecations
is used on the command line in the summary.phpunit.xml:
Composer info:
The text was updated successfully, but these errors were encountered: