create email and emailer with tests
This commit is contained in:
parent
86787b7d3f
commit
962614ea02
4 changed files with 168 additions and 0 deletions
58
tests/Unit/Email/EmailTest.php
Normal file
58
tests/Unit/Email/EmailTest.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit\Email;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use FreightQuote\Email\Email;
|
||||
|
||||
class EmailTest extends TestCase
|
||||
{
|
||||
private Email $email;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->email = new Email();
|
||||
}
|
||||
|
||||
public function test_email_recipients(): void
|
||||
{
|
||||
$emailAddress = 'test@email.com';
|
||||
$this->email->addRecipient($emailAddress);
|
||||
$this->assertEquals([$emailAddress], $this->email->getRecipients());
|
||||
}
|
||||
|
||||
public function test_email_cc(): void
|
||||
{
|
||||
$emailAddress = 'test@email.com';
|
||||
$this->email->addCC($emailAddress);
|
||||
$this->assertEquals([$emailAddress], $this->email->getCC());
|
||||
}
|
||||
|
||||
public function test_email_bcc(): void
|
||||
{
|
||||
$emailAddress = 'test@email.com';
|
||||
$this->email->addBCC($emailAddress);
|
||||
$this->assertEquals([$emailAddress], $this->email->getBCC());
|
||||
}
|
||||
|
||||
public function test_email_subject(): void
|
||||
{
|
||||
$subject = 'test subject';
|
||||
$this->email->setSubject($subject);
|
||||
$this->assertEquals($subject, $this->email->getSubject());
|
||||
}
|
||||
|
||||
public function test_email_body(): void
|
||||
{
|
||||
$body = 'test body';
|
||||
$this->email->setBody($body);
|
||||
$this->assertEquals($body, $this->email->getBody());
|
||||
}
|
||||
|
||||
public function test_email_attachments(): void
|
||||
{
|
||||
$path = '/path/to/file';
|
||||
$this->email->addAttachment($path);
|
||||
$this->assertEquals([$path], $this->email->getAttachments());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue