Level 15
Just a stab in the dark here. Do you need to pass the environment to the artisan call? I guess you've got a test env, so would it need to be Artisan::call('the command --env=testing')
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Currently the following test fails, removed a lot of code so its less to read just trying to get the point across.
The expected [App\Notifications\AnotherReActivationNotification] notification was not sent.
├ Failed asserting that false is true.
But another test that tests the first notification is sent passes.
/** @test */
public function this_is_my_test() {
Notification::fake();
$suspendedParticipant = // a user model
$manager = // users manager
Artisan::call('the command');
Notification::assertSentTo($manager, AnotherReActivationNotification::class);
}
some code from command
$participants->each(function ($participant) {
$participant->notify(new ReActivationNotification());
$participant->manager->notify(new AnotherReActivationNotification())
});
Just a stab in the dark here. Do you need to pass the environment to the artisan call? I guess you've got a test env, so would it need to be Artisan::call('the command --env=testing')
Please or to participate in this conversation.