Skip to content

Commit

Permalink
Add Don't Track Option that stops ALL emails
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett Bailey authored and jdavidbakr committed Jan 30, 2024
1 parent 70f45a4 commit a4b31df
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/MailTrackerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,17 @@ public function it_doesnt_track_if_told_not_to()
{
$faker = Factory::create();
$email = $faker->email;
$anotherEmail = $faker->email;
$subject = $faker->sentence;
$name = $faker->firstName . ' ' .$faker->lastName;
View::addLocation(__DIR__);
try {
Mail::send('email.test', [], function ($message) use ($email, $subject, $name) {
Mail::send('email.test', [], function ($message) use ($email, $anotherEmail, $subject, $name) {
$message->from('[email protected]', 'From Name');
$message->sender('[email protected]', 'Sender Name');

$message->to($email, $name);
$message->to($anotherEmail, $name);

$message->cc('[email protected]', 'CC Name');
$message->bcc('[email protected]', 'BCC Name');
Expand All @@ -323,13 +325,20 @@ public function it_doesnt_track_if_told_not_to()
}

$this->assertDatabaseMissing('sent_emails', [
'recipient' => $name.' <'.$email.'>',
'subject' => $subject,
'sender_name' => 'From Name',
'sender_email' => '[email protected]',
'recipient_name' => $name,
'recipient_email' => $email,
]);
'subject' => $subject,
'sender_name' => 'From Name',
'sender_email' => '[email protected]',
'recipient_name' => $name,
'recipient_email' => $email,
]);

$this->assertDatabaseMissing('sent_emails', [
'subject' => $subject,
'sender_name' => 'From Name',
'sender_email' => '[email protected]',
'recipient_name' => $name,
'recipient_email' => $anotherEmail,
]);
}

/**
Expand Down

0 comments on commit a4b31df

Please sign in to comment.