TIDE/backend/tests/Fakes/FakeEmailer.php

35 lines
710 B
PHP

<?php
namespace Tests\Fakes;
use App\Email\Emailer;
class FakeEmailer implements Emailer
{
/**
* @var array<int, array{from: string, to: string, body: string}>
*/
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<int, array{from: string, to: string, body: string}>
*/
public function getSentEmails(): array
{
return $this->sentEmails;
}
}