-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
CommandStarted and CommandFinished no longer testable in PhpUnit #46629
Comments
Add the following command if you want to test command events: $this->app[\Illuminate\Contracts\Console\Kernel::class]->rerouteSymfonyCommandEvents(); |
Its a good work around, but I still consider this a breaking change. |
so you say, that if we JUST remove the if($app->runningUnitTests()) statement, we have a memoryleak? |
yes |
Weird. will it be mentioned in the docs? because it took me all day to figure out it was laravel and not my changes in my project. |
I'm sorry you got caught by this. But given the fact that the above PR solves a significant memory leak we won't be reverting this. Since probably very people are using/relying on this we'll not mention this anywhere explicitly. |
Description:
I traced it back to this pull request which was about memory leaks, but now it does no longer dispatch the Events when running from phpunit.
That is because of the if statement around it.
framework/src/Illuminate/Foundation/Console/Kernel.php
Lines 121 to 123 in 485f223
This was possible in earlier versions of Laravel, so this is definitely a breaking change.
Steps To Reproduce:
the following test will succeed in earlier versions of laravel:
The text was updated successfully, but these errors were encountered: