From b60dbfe2d686b25e0f95f2d73fc77832bb67987b Mon Sep 17 00:00:00 2001 From: Pablo Kebees Date: Sat, 14 Mar 2026 08:36:29 +0100 Subject: [PATCH] fix: assertNotified() and assertNotNotified() without args now assert (#19500) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 filamentphp/filament#19499 Co-Authored-By: Claude Opus 4.6 * Update ForceDeleteAction.php --------- Co-authored-by: Pablo Kebees Co-authored-by: Claude Opus 4.6 Co-authored-by: Dan Harrin --- packages/actions/src/ForceDeleteAction.php | 2 ++ packages/notifications/src/Notification.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/packages/actions/src/ForceDeleteAction.php b/packages/actions/src/ForceDeleteAction.php index da7e2c0646..27ef7bba3c 100644 --- a/packages/actions/src/ForceDeleteAction.php +++ b/packages/actions/src/ForceDeleteAction.php @@ -27,6 +27,8 @@ class ForceDeleteAction extends Action $this->modalSubmitActionLabel(__('filament-actions::force-delete.single.modal.actions.delete.label')); + $this->successNotificationTitle(__('filament-actions::force-delete.single.notifications.deleted.title')); + $this->defaultColor('danger'); $this->tableIcon(FilamentIcon::resolve(ActionsIconAlias::FORCE_DELETE_ACTION) ?? Heroicon::Trash); diff --git a/packages/notifications/src/Notification.php b/packages/notifications/src/Notification.php index 2d77ca7909..19c1637aa5 100644 --- a/packages/notifications/src/Notification.php +++ b/packages/notifications/src/Notification.php @@ -262,6 +262,11 @@ class Notification extends ViewComponent implements Arrayable, HasEmbeddedView } if (blank($notification)) { + Assert::assertNotEmpty( + $notifications->toArray(), + 'A notification was expected but none were sent.', + ); + return; } @@ -298,6 +303,11 @@ class Notification extends ViewComponent implements Arrayable, HasEmbeddedView } if (blank($notification)) { + Assert::assertEmpty( + $notifications->toArray(), + 'No notification was expected but at least one was sent.', + ); + return; }