Skip to content

Commit 7e9ae3b

Browse files
committed
More tests.
1 parent e5a301d commit 7e9ae3b

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/Actions/SendMailAction.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ public function handle(MailatorSchedule $schedule)
2323
protected function sendMail(MailatorSchedule $schedule)
2424
{
2525
//todo - apply replacers for variables maybe
26-
if (empty($schedule->getRecipients())) {
27-
return;
28-
}
29-
3026
Mail::to($schedule->getRecipients())->send(
3127
$schedule->getMailable()
3228
);

tests/Feature/Models/MailatorScheduleTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function test_sending_email_only_once()
6868

6969
MailatorSchedule::init('Invoice reminder.')
7070
->recipients([
71-
'foo@bar.com',
71+
'zoo@bar.com',
7272
])
7373
->mailable(
7474
(new InvoiceReminderMailable())->to('[email protected]')
@@ -82,5 +82,17 @@ public function test_sending_email_only_once()
8282
$_SERVER['can_send'] = true;
8383
MailatorSchedule::run();
8484
Mail::assertSent(InvoiceReminderMailable::class, 1);
85+
86+
$_SERVER['can_send'] = false;
87+
88+
MailatorSchedule::run();
89+
Mail::assertSent(InvoiceReminderMailable::class, 1);
90+
91+
MailatorSchedule::run();
92+
Mail::assertSent(InvoiceReminderMailable::class, 1);
93+
94+
Mail::assertSent(InvoiceReminderMailable::class, function (InvoiceReminderMailable $mail) {
95+
return $mail->hasTo('[email protected]') && $mail->hasTo('[email protected]');
96+
});
8597
}
8698
}

0 commit comments

Comments
 (0)