fix: remind house managers of their own pending list at the teamer reminder pace
This commit is contained in:
1 parent
ab6ffd4eda
commit
77d7000df3
11 files changed
+515
-73
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Service\Cron;
|
||||
|
||||
use App\Service\Cron\ReminderCadence;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ReminderCadenceTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return iterable<string, array{int, bool}>
|
||||
*/
|
||||
public static function nights(): iterable
|
||||
{
|
||||
yield 'the day the trip ends' => [0, false];
|
||||
yield 'first night after' => [1, true];
|
||||
yield 'last daily night' => [7, true];
|
||||
yield 'first quiet night' => [8, false];
|
||||
yield 'still quiet' => [13, false];
|
||||
yield 'two weeks' => [14, true];
|
||||
yield 'three weeks' => [21, true];
|
||||
yield 'between the weeks' => [22, false];
|
||||
yield 'months later' => [70, true];
|
||||
}
|
||||
|
||||
#[DataProvider('nights')]
|
||||
public function testDailyForAWeekThenWeekly(int $nights, bool $due): void
|
||||
{
|
||||
$today = new \DateTimeImmutable('2026-11-20');
|
||||
|
||||
$this->assertSame($due, ReminderCadence::isDue($today->modify(sprintf('-%d days', $nights)), $today));
|
||||
}
|
||||
|
||||
public function testTheTimeOfDayDoesNotCount(): void
|
||||
{
|
||||
$this->assertTrue(ReminderCadence::isDue(new \DateTimeImmutable('2026-11-13 23:59'), new \DateTimeImmutable('2026-11-20 01:00')));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user