create email and emailer with tests
This commit is contained in:
parent
86787b7d3f
commit
962614ea02
4 changed files with 168 additions and 0 deletions
27
tests/Fakes/Email/FakeEmailer.php
Normal file
27
tests/Fakes/Email/FakeEmailer.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Fakes\Email;
|
||||
|
||||
use FreightQuote\Email\Email;
|
||||
use FreightQuote\Email\Emailer;
|
||||
|
||||
class FakeEmailer implements Emailer
|
||||
{
|
||||
private int $sentEmailCount = 0;
|
||||
|
||||
public function getSentEmailCount(): int
|
||||
{
|
||||
return $this->sentEmailCount;
|
||||
}
|
||||
|
||||
public function send(Email $email): bool
|
||||
{
|
||||
if (count($email->getRecipients()) > 0) {
|
||||
$this->sentEmailCount++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue