pimski
160
9
Testing

How do you test database notifications?

Posted 8 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.

Reply to

Use Markdown with GitHub-flavored code blocks.