function UltimateCronRulesUnitTestCase::testRules5MinuteRange in Ultimate Cron 6
Same name and namespace in other branches
- 7.2 tests/rules.test \UltimateCronRulesUnitTestCase::testRules5MinuteRange()
- 7 tests/rules.test \UltimateCronRulesUnitTestCase::testRules5MinuteRange()
File
- tests/
rules.test, line 241 - Tests for Ultimate Cron's cron parser
Class
Code
function testRules5MinuteRange() {
// Test a 5 minute range
$result = $this
->runTest(array(
'result' => FALSE,
'rules' => '10-15 12 * * *',
'last_run' => '2008-01-03 12:00:00',
'now' => '2008-01-03 12:09:00',
'catch_up' => 1,
));
$this
->assertTRUE($result[0], $result[1]);
$result = $this
->runTest(array(
'result' => TRUE,
'rules' => '10-15 12 * * *',
'last_run' => '2008-01-03 12:00:00',
'now' => '2008-01-03 12:10:00',
'catch_up' => 1,
));
$this
->assertTRUE($result[0], $result[1]);
$result = $this
->runTest(array(
'result' => TRUE,
'rules' => '10-15 12 * * *',
'last_run' => '2008-01-03 12:00:00',
'now' => '2008-01-03 12:11:00',
'catch_up' => 1,
));
$this
->assertTRUE($result[0], $result[1]);
$result = $this
->runTest(array(
'result' => TRUE,
'rules' => '10-15 12 * * *',
'last_run' => '2008-01-03 12:00:00',
'now' => '2008-01-03 12:12:00',
'catch_up' => 1,
));
$this
->assertTRUE($result[0], $result[1]);
$result = $this
->runTest(array(
'result' => TRUE,
'rules' => '10-15 12 * * *',
'last_run' => '2008-01-03 12:00:00',
'now' => '2008-01-03 12:13:00',
'catch_up' => 1,
));
$this
->assertTRUE($result[0], $result[1]);
$result = $this
->runTest(array(
'result' => TRUE,
'rules' => '10-15 12 * * *',
'last_run' => '2008-01-03 12:00:00',
'now' => '2008-01-03 12:14:00',
'catch_up' => 1,
));
$this
->assertTRUE($result[0], $result[1]);
$result = $this
->runTest(array(
'result' => TRUE,
'rules' => '10-15 12 * * *',
'last_run' => '2008-01-03 12:00:00',
'now' => '2008-01-03 12:15:00',
'catch_up' => 1,
));
$this
->assertTRUE($result[0], $result[1]);
// This should not run, as it last ran one minute ago
$result = $this
->runTest(array(
'result' => FALSE,
'rules' => '10-15 12 * * *',
'last_run' => '2008-01-03 12:15:00',
'now' => '2008-01-03 12:16:00',
));
$this
->assertTRUE($result[0], $result[1]);
// This should run, as catch_up defaults to 1 year and it last ran 16 minutes ago.
$result = $this
->runTest(array(
'result' => TRUE,
'rules' => '10-15 12 * * *',
'last_run' => '2008-01-03 12:00:00',
'now' => '2008-01-03 12:16:00',
));
$this
->assertTRUE($result[0], $result[1]);
}