-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Tests does not trigger CommandFinished #58346
Copy link
Copy link
Closed
Description
Laravel Version
12.0
PHP Version
8.2.6
Database Driver & Version
No response
Description
I would like to use Illuminate\Console\Events\CommandFinished to handle all tests result as one bunch of data. So I decided to use CommandFinished which seems to fit perfectly my needs. BUT as I found out this event works fine with any other artisan commands but not with test command. I made some simple logs in listener handle method and as I said every artisan command works fine BUT test command does not trigger the event.
Steps To Reproduce
I have CommanfFinishedListener class which listen for CommandFinished event registered. I see the listener is registered properly. I also see the listern and event works fine with any other artisan commands but not with test command. This is my
<?php
namespace App\Listeners;
use App\Services\BaseService;
use Illuminate\Console\Events\CommandFinished;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
class CommandFinishedListener
{
/**
* Create the event listener.
*/
public function __construct()
{
//
}
/**
* Handle the event.
*/
public function handle(CommandFinished $event)
{
Log::info('111111111111111'); // I see this log for any other command BUT NOT for test command
Log::info('CommandFinishedListener: ' . $event->command);
if ( $event->command === 'test' ) {
Log::info('2222222222222'); // This is never logged anywhere
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.