Skip to content

Commit b60dbfe

Browse files
PhaenPablo Kebeesclaudedanharrin
authored
fix: assertNotified() and assertNotNotified() without args now assert (#19500)
* fix: make assertNotified() and assertNotNotified() without args assert When called without arguments, both methods previously hit a `blank()` check and returned early — making no assertion at all. They always passed, even when the assertion should have failed. Now assertNotified() without args asserts that at least one notification was sent, and assertNotNotified() without args asserts that no notifications were sent. Fixes #19499 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Update ForceDeleteAction.php --------- Co-authored-by: Pablo Kebees <pablo@i-aspect.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Dan Harrin <git@danharrin.com>
1 parent efa041a commit b60dbfe

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/actions/src/ForceDeleteAction.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ protected function setUp(): void
2727

2828
$this->modalSubmitActionLabel(__('filament-actions::force-delete.single.modal.actions.delete.label'));
2929

30+
$this->successNotificationTitle(__('filament-actions::force-delete.single.notifications.deleted.title'));
31+
3032
$this->defaultColor('danger');
3133

3234
$this->tableIcon(FilamentIcon::resolve(ActionsIconAlias::FORCE_DELETE_ACTION) ?? Heroicon::Trash);

packages/notifications/src/Notification.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ public static function assertNotified(Notification | string | null $notification
262262
}
263263

264264
if (blank($notification)) {
265+
Assert::assertNotEmpty(
266+
$notifications->toArray(),
267+
'A notification was expected but none were sent.',
268+
);
269+
265270
return;
266271
}
267272

@@ -298,6 +303,11 @@ public static function assertNotNotified(Notification | string | null $notificat
298303
}
299304

300305
if (blank($notification)) {
306+
Assert::assertEmpty(
307+
$notifications->toArray(),
308+
'No notification was expected but at least one was sent.',
309+
);
310+
301311
return;
302312
}
303313

0 commit comments

Comments
 (0)