Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes problems described in #40592 (comment)
TLDR; Laravel never cleaned up its handlers, resulting in the PHPUnit error handler never firing for unit tests that came after Laravel's integration tests, plus since the handlers were never cleaned it resulted in a memory leak.
In order to avoid having to call
$this->withoutDeprecationHandling()
in every Laravel integration test I've added that call in theprotected function deprecationHandling()
hook method which is now called from the base test classsetUp
method (users can override it in their base class if they want to change the behavior).The changes made in the base test class here should also be ported over to Testbench, after which I can fix all the deprecation exceptions that will pop up on CI, before this PR can be merged.
Also note that this PR makes use of a terminating callback to restore the handlers, which also meant having to manually call
$this->app->terminate()
in the test teardown (it's weird that this was not already called asterminate
is always called in a real HTTP request).Fixes #40554