Skip to content

Commit 98e268e

Browse files
committed
Stop when custom constraints false when stoppable.
1 parent aeeb20a commit 98e268e

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/Dto/WormholeConfiguration.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Binarcode\LaravelMailator\Dto;
4+
5+
class WormholeConfiguration
6+
{
7+
public string $frequency_option;
8+
}

src/Models/MailatorSchedule.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,9 @@ public function shouldSend(): bool
338338
}
339339

340340
if (! $this->eventsPasses()) {
341-
$this->markComplete();
341+
if ($this->isStopable()) {
342+
$this->markComplete();
343+
}
342344

343345
return false;
344346
}

tests/Feature/StopableSchedulerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function test_stopable_scheduler_mark_completed_when_constraint_falsy():
1414
{
1515
Mail::fake();
1616

17-
$invoiceExpiration = now()->days(10);
17+
$invoiceExpiration = now()->addDays(10);
1818

1919
Mail::assertNothingSent();
2020

@@ -32,7 +32,7 @@ public function test_stopable_scheduler_mark_completed_when_constraint_falsy():
3232

3333
Mail::assertNothingSent();
3434

35-
$this->travel(3)->days();
35+
$this->travel(4)->days();
3636

3737
Scheduler::run();
3838
Mail::assertSent(InvoiceReminderMailable::class, 1);

0 commit comments

Comments
 (0)