Attainly/backend/tests/Fakes/FakeEmailer.php

48 lines
942 B
PHP

<?php
namespace Tests\Fakes;
use App\Email\Emailer;
use App\Shared\ValueObject\EmailAddress;
class FakeEmailer implements Emailer
{
private int $sendCount = 0;
private ?EmailAddress $lastRecipient = null;
private ?string $lastSubject = null;
private ?string $lastBody = null;
public function send(
EmailAddress $recipient,
string $subject,
string $body,
): void {
$this->sendCount++;
$this->lastRecipient = $recipient;
$this->lastSubject = $subject;
$this->lastBody = $body;
}
public function getSendCount(): int
{
return $this->sendCount;
}
public function getLastRecipient(): ?EmailAddress
{
return $this->lastRecipient;
}
public function getLastSubject(): ?string
{
return $this->lastSubject;
}
public function getLastBody(): ?string
{
return $this->lastBody;
}
}