[5.3] Make afterApplicationCreated() callback registration public #15493
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.
Rational: when using e.g. PHPUnit Listener we receive the test class before a certain test has run.
This allows further inspection or adding additional stuff.
Unfortunately it doesn't allow registering additional after application callbacks from e.g.
\PHPUnit_Framework_TestListener::startTest
because the method\Illuminate\Foundation\Testing\TestCase::afterApplicationCreated
isn't public => this PR changes this.A concrete example what I'm doing: for every test in my Listener I'm registering a callback which in-depth analyzes the SQL statements performed. But I can only hook into
DB::listen
once the application is "started", as such I need to do this in the mentioned callbacks. But currently it's not directly possible to the visibility.It's possible to workaround this but my understanding is that
TestCase
should be open in this regard to be more flexible, like in this scenario I described.