Skip to content

Commit

Permalink
test notification receives original exception
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbonnick committed Aug 25, 2023
1 parent 3e06737 commit dc70da6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Notifications/EventHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
Notification::assertSentTimes(BackupHasFailedNotification::class, 1);
});

test('notification contains the original exception instead of BackupFailed', function(){
$exception = BackupFailed::from(new InvalidArgumentException('Something Went Wrong...'));

event(new BackupHasFailed($exception->getPrevious()));

Notification::assertSentTo(new Notifiable(), BackupHasFailedNotification::class, function ($notification) {
return $notification->event->exception instanceof InvalidArgumentException;
});
});

function fireBackupHasFailedEvent()
{
$exception = new Exception('Dummy exception');
Expand Down

0 comments on commit dc70da6

Please sign in to comment.