-
Notifications
You must be signed in to change notification settings - Fork 11.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
PHPUnit warning: Test code or tested code did not remove its own exception handlers #49502
Comments
PHPUnit change that introduced this BC issue: sebastianbergmann/phpunit#5619. |
@nunomaduro Shouldnt this be reported upstream as a regression? |
@rikvdh It's done. Sebastian is considering reverting it. |
Reverted. Problem solved. |
I never had this issue in 10.x, but I just upgraded from latest 10.x to latest 11.x and 11.0.4 and I'm seeing this on every single test in my project |
i get the same error since laravel update. PHPUnit 11.0.9 and Laravel 11.2.0 |
I can confirm this has reappeared:
Looks like it's been re-introduced. |
Yup, Sebastian said it would be reintroduced in 11. What's the current work around other than using older phpunit? |
@oceanapplications various workarounds are presented in the Symfony thread: symfony/symfony#53812 (comment) |
Putting the below in (what would be) my public function tearDown(): void
{
parent::tearDown();
restore_error_handler();
restore_exception_handler();
} |
We updated to L11 last week and today Dependabot bumped PHPUnit to v11 and these errors starting to appear for all tests:
As of now, we can't find any working solution. This issue points to Symfony thread which is still open and redirects back to #49622. Does anyone have a working solution? @phily245 suggestion didn't do the trick :( |
We have been digging into this issue at work with a new project. My boss found that removing newRelic in the docker container solved resolved the "Test code or tested code removed..." errors. He also mentioned there appears to be a memory leak in PHPUnit 11.3, though that has not yet been confirmed. I can confirm on my instance, removing newRelic from the docker container did resolve issues for me. Tests execute as expected now. |
I also confirm, removing new relic from my docker container fixed this. But I can't confirm the phpunit memory leak |
Reading the phpunit documentation, we can find the #[WithoutErrorHandler] attribute mention on your test method. Using this attribute fix the "risky" message. |
Laravel Version
Any that uses PHPUnit ^10
PHP Version
Any
Database Driver & Version
No response
Description
Seems that, since PHPUnit 10.5.4, running any kind of test suite that boots the Laravel Framework displays the following warning multiple times:
Test code or tested code did not remove its own exception handlers
.Steps To Reproduce
laravel new laravel cd laravel ./vendor/bin/phpunit
The text was updated successfully, but these errors were encountered: