-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PhpUnitBridge] Deprecation bridge for PHPUnit 10.2 #50371
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
Made changes to report error/failures at the report-out time, and advocated exiting early if bridge's status is higher than phpunit's exit code. |
The deprecations being expected by legacy tests should still be checked during the test run. This should be implemented by having a post condition method (i.e. a protected method with the |
This PR needs to be rebased, it currently has 152 commits and 3762 files changed. |
@OskarStark this reference to your above ticket on the phpunit repo is really worth mentioning over here! 🙌 Is that feature introduced in PHPUnit for all PHP versions that are supported by the Symfony PhpUnitBridge? |
I am not sure and didn't test the feature yes, I just proposed the idea and @sebastianbergmann implemented it |
It will be part of PHPUnit 10.5 (release due Dec 1 2023), that requires PHP >=8.1. Do not expect backports. |
For the record, in Drupal we are working on a possible alternative without the bridge, implementing an error handler shim on top of PHPUnit's one, for every test. Sharing in case something there might be reused here. |
This is a first attempt at implementing the deprecation bridge for PHPUnit 10, re #49069. Given the massive changes in PHPUnit internals, the deprecation bridge will have, one way or another, to change accordingly.
So ATM this is more to share my findings to enable a discussion on what the bridge should look like.
The PR is functional, but only partially, and totally untested.
Key points:
E_*
errors into events that are then channeled through the new system, i.e. dispatched to subscribers. SoSymfonyTestsListener
andDeprecationErrorHandler
implementations cannot be just reused. ==> My proposal here is to replace these, for the deprecation bridge, with an event collector and event subscribers.For the time being, I made so that where errors or fails should be triggered, we have aErrors and failures due to the bridge are reported at report-out and no longer as errors/failures in the cli.dump()
instead. But that needs to change.trigger_error()
call is prefixed with the@
symbol). But unsilenced deprecations would be reported by both the bridge (according to its configuration) and by PHPUnit itself (unconditionally).I do not know yet (have not investigated) whether it's possible to influence PHPUnit's cli exit code.(unreleased yet)is the minimum version for this PR. That's because earlier than that, silenced deprecations were not even processed by the error handler, and that was only fixed in Optionally ignore suppression of deprecations, notices, and warnings sebastianbergmann/phpunit#5328