-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Foundry should not remove symfony-s errorHandlers #640
Comments
Hi @mmarton this is a complex topic, the main problem with the workardound Still, I do understand that the chosen solution is unfortunate as well. more over the problem is between Symfony and PHPUnit, and Foundry has nothing to deal with it.. But for the migration between foundry v1 and v2, the ability to display deprecation is kinda super helpful. The problem occurs because methods marked as I think our hands are tied here 😞 (I've been thinking about introducing a PHPUnit Extension for Foundry for a long time, maybe that would be a way to mitigate this problem. But we would still need to mess around with Symfony's exception handler, which is not Foundry's responsibility, I admit) @kbond any thoughts? |
@mmarton, to confirm, are you using phpunit 10+? |
Yes, the latest 11.2 version |
after a lot a of digging, I've just figured out that the main reason of why we've introduced this whole "error handlers resetting" stuff is because when the kernel is booted in a "before class" hook, the deprecation won't bubble up in PHPUnit (because Symfony registers its error handler before PHPUnit, and then PHPUnit won't register its own error handler if one already exists. see both here and here So we had to find a way to prevent this when using |
I've released |
Just tested with 1.38.2 and it fixed my issue. Thanks |
Hi!
starting from 1.38 foundry removes symfonys error handlers in KernelHelper::shutdownKernel().
You should not remove something that's another library started. Or at least not in a forced way, just include the helper and let the user decide if he want to call it.
There is a proposed way in the issue mentioned in the Kernelhelper class to handle this.
symfony/symfony#53812 (comment)
Using it with Foundry displays 'Test code or tested code removed error handlers other than its own' warning.
my test
Running this with your solution:
Adding set_exception_handler([new ErrorHandler(), 'handleException']); to tests/bootstrap.php:
Adding set_exception_handler([new ErrorHandler(), 'handleException']); to tests/bootstrap.php AND commenting out the call to KernelHelper:
The text was updated successfully, but these errors were encountered: