Skip to content

Commit 726446c

Browse files
committed
Add more assertions
1 parent 349a9e2 commit 726446c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/Commands/WatchMailboxTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use RuntimeException;
1818

1919
use function Pest\Laravel\artisan;
20+
use function Pest\Laravel\freezeTime;
2021

2122
it('throws exception when mailbox is not configured', function () {
2223
artisan(WatchMailbox::class, ['mailbox' => 'invalid']);
@@ -52,6 +53,8 @@
5253
});
5354

5455
it('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
});

0 commit comments

Comments
 (0)