How do you test database notifications?

Posted 6 months ago by pimski

Hi there,

How do you test database notifications? The following piece of code works when running in the browser, but gives no results when running in a test case:

auth()->user()->notify(new \App\Notifications\ExportFinished);
dd(\DB::table('notifications')->select()->get()); // empty result set in test

Is the test 'mocking' the notification? I'm not calling Notification::fake(); in my test!

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.