File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717use RuntimeException ;
1818
1919use function Pest \Laravel \artisan ;
20+ use function Pest \Laravel \freezeTime ;
2021
2122it ('throws exception when mailbox is not configured ' , function () {
2223 artisan (WatchMailbox::class, ['mailbox ' => 'invalid ' ]);
5253});
5354
5455it ('dispatches event when failure attempts have been reached ' , function () {
56+ $ datetime = freezeTime ();
57+
5558 Config::set ('imap.mailboxes.test ' , [
5659 'host ' => 'localhost ' ,
5760 'port ' => 993 ,
@@ -84,5 +87,9 @@ public function idle(
8487 // Do nothing.
8588 }
8689
87- Event::assertDispatched (MailboxWatchAttemptsExceeded::class);
90+ Event::assertDispatched (function (MailboxWatchAttemptsExceeded $ event ) {
91+ return $ event ->mailbox === 'test '
92+ && is_null ($ event ->lastReceivedAt )
93+ && $ event ->exception ->getMessage () === 'Simulated exception ' ;
94+ });
8895});
You can’t perform that action at this time.
0 commit comments