File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 66use PHPUnit \Framework \AssertionFailedError ;
77use Tempest \Mail \Attachment ;
88use Tempest \Mail \Email ;
9+ use Tempest \Mail \EmailWasSent ;
910use Tempest \Mail \GenericEmail ;
1011use Tests \Tempest \Integration \FrameworkIntegrationTestCase ;
1112use Tests \Tempest \Integration \Mailer \Fixtures \SendWelcomeEmail ;
@@ -79,4 +80,22 @@ public function test_assertions(): void
7980 $ this ->assertSame ('hello! ' , ($ email ->attachments [0 ]->resolve )());
8081 });
8182 }
83+
84+ public function test_email_was_sent_event_was_dispatched (): void
85+ {
86+ $ this ->eventBus ->preventEventHandling ();
87+
88+ $ this ->mailer
89+ ->send (email: new GenericEmail (
90+ subject: 'Hello ' ,
91+ 92+ html: 'Hello Jon ' ,
93+ 94+ attachments: [
95+ Attachment::fromClosure (callable: fn () => 'hello! ' ),
96+ ],
97+ ));
98+
99+ $ this ->eventBus ->assertDispatched (event: EmailWasSent::class);
100+ }
82101}
You can’t perform that action at this time.
0 commit comments