-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Description
- Laravel Version: 10.4.1
- PHP Version: 8.2.4
- Database Driver & Version: -
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
| if (! $this->app->runningUnitTests()) { | |
| $this->rerouteSymfonyCommandEvents(); | |
| } |
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:
public function testFailingCommandEvents()
{
$actual = false;
Event::listen(CommandStarting::class, function () use (&$actual) {
$actual = true;
});
Artisan::command(
'myApplication',
function () {
}
);
Artisan::call('myApplication');
$this->assertTrue($actual);
}Metadata
Metadata
Assignees
Labels
No labels