mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-21 13:30:51 +08:00
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 filamentphp/filament#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>
This commit is contained in:
co-authored by
Claude Opus 4.6
Pablo Kebees
Dan Harrin
parent
efa041aeeb
commit
b60dbfe2d6
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user