Skip to content

Commit 932a34d

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

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Tempest\Database\Testing\DatabaseTester;
2626
use Tempest\DateTime\DateTimeInterface;
2727
use Tempest\Discovery\DiscoveryLocation;
28-
use Tempest\EventBus\EventBus;
2928
use Tempest\EventBus\Testing\EventBusTester;
3029
use Tempest\Framework\Testing\Http\HttpRouterTester;
3130
use Tempest\Http\GenericRequest;
@@ -142,9 +141,7 @@ protected function setupTesters(): self
142141
$this->eventBus = new EventBusTester($this->container);
143142
$this->storage = new StorageTester($this->container);
144143
$this->cache = new CacheTester($this->container);
145-
$this->mailer = new MailTester(new TestingMailer(
146-
eventBus: $this->container->get(EventBus::class),
147-
));
144+
$this->mailer = new MailTester(new TestingMailer());
148145

149146
$this->process = $this->container->get(ProcessTester::class);
150147
$this->process->disableProcessExecution();

0 commit comments

Comments
 (0)