Skip to content

Commit f4198db

Browse files
committed
feat(event-bus): wire mailer event bus into testing helpers
1 parent 41225f2 commit f4198db

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/mail/src/Testing/TestingMailer.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
use Tempest\Mail\EmailWasSent;
88
use Tempest\Mail\Mailer;
99

10+
use function Tempest\get;
11+
1012
final class TestingMailer implements Mailer
1113
{
12-
public function __construct(
13-
private readonly ?EventBus $eventBus = null,
14-
) {}
14+
private EventBus $eventBus {
15+
get => get(className: EventBus::class);
16+
}
1517

1618
/**
1719
* List of emails that would have been sent.

src/Tempest/Framework/Testing/IntegrationTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ protected function setupTesters(): self
142142
$this->eventBus = new EventBusTester($this->container);
143143
$this->storage = new StorageTester($this->container);
144144
$this->cache = new CacheTester($this->container);
145-
$this->mailer = new MailTester(new TestingMailer(
146-
eventBus: $this->container->get(EventBus::class),
147-
));
145+
$this->mailer = new MailTester(new TestingMailer());
148146

149147
$this->process = $this->container->get(ProcessTester::class);
150148
$this->process->disableProcessExecution();

0 commit comments

Comments
 (0)