You are here

function UltimateCronRulesUnitTestCase::testIntervals2MinuteRangeWithOffset in Ultimate Cron 6

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

File

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

Class

UltimateCronRulesUnitTestCase
@file

Code

function testIntervals2MinuteRangeWithOffset() {
  $intervals = $this
    ->getIntervals('0-1+1 12 * * *');
  $this
    ->assertEqual($intervals['minutes'], range(2, 1, -1), 'Expected minutes to be 1, 2');
  $intervals = $this
    ->getIntervals('10-11+1 12 * * *');
  $this
    ->assertEqual($intervals['minutes'], range(12, 11, -1), 'Expected minutes to be 11, 12');

  // Note, this test is testing for correct behaviour when the minutes wrap around
  // Previously, this test would generate 43, 0 due to a bug in expandRange/expandInterval
  $intervals = $this
    ->getIntervals('42-43+1 12 * * *');
  $this
    ->assertEqual($intervals['minutes'], array(
    44,
    43,
  ), 'Expected minutes to be 43, 44');

  // Note, this test is testing for correct behaviour when the minutes wrap around
  $intervals = $this
    ->getIntervals('58-59+1 12 * * *');
  $this
    ->assertEqual($intervals['minutes'], array(
    59,
    0,
  ), 'Expected minutes to be 59, 0');
}