You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing an issue where my Laravel notification test isn't passing when I try to assert that a notification was sent on-demand to a specific email address. Here's the context:
// ... test setup ...Notification::assertSentOnDemand(ApplicationCreatedNotification::class); // This assertion fails// ... other assertions ...
Problem
The dd() function in the event listener confirms that the code is executed.
The notification class is correctly set up (ApplicationCreatedNotification).
The test fails specifically on the assertSentOnDemand assertion.
I've tested similar scenarios where the notification is sent to a User object, and those tests pass successfully.
I'm using Notification::fake() at the beginning of my test.
Additional Details:
Laravel Version: 11.9
Does anyone have any insights into why this assertSentOnDemand assertion is failing when the notification is manually routed to an email address? Am I missing something specific for on-demand notifications?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone,
I'm facing an issue where my Laravel notification test isn't passing when I try to assert that a notification was sent on-demand to a specific email address. Here's the context:
Event Listener
Test
Problem
dd()
function in the event listener confirms that the code is executed.ApplicationCreatedNotification
).assertSentOnDemand
assertion.User
object, and those tests pass successfully.Additional Details:
11.9
Does anyone have any insights into why this assertSentOnDemand assertion is failing when the notification is manually routed to an email address? Am I missing something specific for on-demand notifications?
Beta Was this translation helpful? Give feedback.
All reactions