shouldReceive('sendPasswordResetCode') ->once() ->with(10, 'tenant-test') ->andThrow($exception); $this->app->instance(NotificationMailService::class, $mailService); Log::shouldReceive('error') ->once() ->with( 'Failed to send password reset email.', \Mockery::on(fn (array $context): bool => $context['attempt_id'] === 10 && $context['tenant_code'] === 'tenant-test' && $context['exception'] === $exception), ); $this->expectExceptionObject($exception); (new SendPasswordResetEmail)->handle( new PasswordResetRequested(10, 'tenant-test'), ); } }