You are here

function UltimateCronRulesUnitTestCase::testRulesMinuteWithOffset in Ultimate Cron 6

Same name and namespace in other branches
  1. 7.2 tests/rules.test \UltimateCronRulesUnitTestCase::testRulesMinuteWithOffset()
  2. 7 tests/rules.test \UltimateCronRulesUnitTestCase::testRulesMinuteWithOffset()

File

tests/rules.test, line 286
Tests for Ultimate Cron's cron parser

Class

UltimateCronRulesUnitTestCase
@file

Code

function testRulesMinuteWithOffset() {

  // Test a 1 minute range
  $result = $this
    ->runTest(array(
    'result' => FALSE,
    'rules' => '10+1 12 * * *',
    'last_run' => '2008-01-01 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+1 12 * * *',
    'last_run' => '2008-01-01 12:00:00',
    'now' => '2008-01-03 12:11:00',
    'catch_up' => 1,
  ));
  $this
    ->assertTRUE($result[0], $result[1]);
  $result = $this
    ->runTest(array(
    'result' => FALSE,
    'rules' => '10+1 12 * * *',
    'last_run' => '2008-01-01 12:00:00',
    'now' => '2008-01-03 12:12:00',
    'catch_up' => 1,
  ));
  $this
    ->assertTRUE($result[0], $result[1]);
  $result = $this
    ->runTest(array(
    'result' => FALSE,
    'rules' => '59+1 12 * * *',
    'last_run' => '2008-01-01 12:00:00',
    'now' => '2008-01-03 12:59:00',
    'catch_up' => 1,
  ));
  $this
    ->assertTRUE($result[0], $result[1]);
  $result = $this
    ->runTest(array(
    'result' => TRUE,
    'rules' => '59+1 12 * * *',
    'last_run' => '2008-01-01 12:00:00',
    'now' => '2008-01-03 12:00:00',
    'catch_up' => 1,
  ));
  $this
    ->assertTRUE($result[0], $result[1]);
  $result = $this
    ->runTest(array(
    'result' => FALSE,
    'rules' => '59+1 12 * * *',
    'last_run' => '2008-01-01 12:00:00',
    'now' => '2008-01-03 13:00:00',
    'catch_up' => 1,
  ));
  $this
    ->assertTRUE($result[0], $result[1]);
  $result = $this
    ->runTest(array(
    'result' => FALSE,
    'rules' => '59+1 12 * * *',
    'last_run' => '2008-01-01 12:00:00',
    'now' => '2008-01-03 13:01:00',
    'catch_up' => 1,
  ));
  $this
    ->assertTRUE($result[0], $result[1]);
}