Skip to content

Commit

Permalink
More tests around DOW and DOM resolutions
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmantank committed Jan 14, 2022
1 parent d10f969 commit 99a8406
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/Cron/CronExpressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,31 @@ public function testIssue128()
$expected = new \DateTime('2021-12-31 20:00:00');
$prev = $e->getPreviousRunDate(new \DateTime('2022-08-20 03:44:02'), 1);
$this->assertEquals($expected, $prev);

$e = new CronExpression('0 20 L 6,12 0-6');
$expected = new \DateTime('2022-12-01 20:00:00');
$next = $e->getNextRunDate(new \DateTime('2022-08-20 03:44:02'));
$this->assertEquals($expected, $next);

$e = new CronExpression('0 20 L 6,12 0-6');
$expected = new \DateTime('2022-12-02 20:00:00');
$next = $e->getNextRunDate(new \DateTime('2022-08-20 03:44:02'), 1);
$this->assertEquals($expected, $next);

$e = new CronExpression('0 20 L 6,12 0-6');
$expected = new \DateTime('2022-12-03 20:00:00');
$next = $e->getNextRunDate(new \DateTime('2022-08-20 03:44:02'), 2);
$this->assertEquals($expected, $next);

$e = new CronExpression('0 20 * 6,12 *');
$expected = new \DateTime('2022-12-01 20:00:00');
$next = $e->getNextRunDate(new \DateTime('2022-08-20 03:44:02'));
$this->assertEquals($expected, $next);

$e = new CronExpression('0 20 * 6,12 *');
$expected = new \DateTime('2022-12-06 20:00:00');
$next = $e->getNextRunDate(new \DateTime('2022-08-20 03:44:02'), 5);
$this->assertEquals($expected, $next);
}

public function testItCanRegisterAnValidExpression(): void
Expand Down

0 comments on commit 99a8406

Please sign in to comment.