Skip to content

Commit 618718a

Browse files
Fix : notification filter test correct config key and assertion (#90)
The test was passing by accident due to two bugs that masked each other: 1. Wrong config key: Used 'failed-job-monitor.callback' instead of 'failed-job-monitor.notificationFilter', causing the filter to never execute (config returned null, is_callable(null) = false, so default behavior sent notification). 2. Wrong notification class: Asserted that AnotherNotification::class was not sent, but the default notification class is Notification::class. Since the filter didn't run, Notification::class was sent, and the test checked for AnotherNotification::class (which wasn't sent), so it passed incorrectly. The test appeared to work but wasn't actually validating the filter functionality. When the filter should return false (empty exception message), the notification should not be sent, but the test wasn't verifying this correctly. Changes: - Use correct config key 'failed-job-monitor.notificationFilter' - Assert against the correct notification class Notification::class Now the test properly validates that when notificationFilter returns false, no notification is sent to the default Notifiable with the default Notification class.
1 parent c8ca730 commit 618718a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/FailedJobMonitorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ function returnsFalseWhenExceptionIsEmpty($notification)
4848
});
4949

5050
it('filters out notifications when the notificationFilter returns `false`', function () {
51-
config()->set('failed-job-monitor.callback', 'returnsFalseWhenExceptionIsEmpty');
51+
config()->set('failed-job-monitor.notificationFilter', 'returnsFalseWhenExceptionIsEmpty');
5252

5353
fireFailedEvent();
5454

55-
NotificationFacade::assertNotSentTo(new Notifiable(), AnotherNotification::class);
55+
NotificationFacade::assertNotSentTo(new Notifiable(), Notification::class);
5656
});

0 commit comments

Comments
 (0)