diff --git a/backend/app/Email/EmailFactory.php b/backend/app/Email/EmailFactory.php new file mode 100644 index 0000000..43307ad --- /dev/null +++ b/backend/app/Email/EmailFactory.php @@ -0,0 +1,8 @@ +confirmationUrlPrefix}{$token}"; + } +} diff --git a/backend/app/Email/LaravelMailer.php b/backend/app/Email/LaravelMailer.php new file mode 100644 index 0000000..cf41752 --- /dev/null +++ b/backend/app/Email/LaravelMailer.php @@ -0,0 +1,25 @@ +mailer->raw( + $body, + function (Message $message) use ($from, $to) { + $message->from($from) + ->to($to) + ->subject('TIDE'); + } + ); + } +} diff --git a/backend/tests/Fakes/FakeEmailFactory.php b/backend/tests/Fakes/FakeEmailFactory.php new file mode 100644 index 0000000..b6fb069 --- /dev/null +++ b/backend/tests/Fakes/FakeEmailFactory.php @@ -0,0 +1,13 @@ + + */ + private array $sentEmails = []; + + public function send(string $from, string $to, string $body): void + { + $this->sentEmails[] = [ + 'from' => $from, + 'to' => $to, + 'body' => $body, + ]; + } + + public function getNumberOfEmailsSent(): int + { + return count($this->sentEmails); + } + + /** + * @return array + */ + public function getSentEmails(): array + { + return $this->sentEmails; + } +}