private function UltimateCronRulesUnitTestCase::runTest in Ultimate Cron 7.2        
                          
                  
                        Same name and namespace in other branches
- 8 tests/rules.test \UltimateCronRulesUnitTestCase::runTest()
 - 6 tests/rules.test \UltimateCronRulesUnitTestCase::runTest()
 - 7 tests/rules.test \UltimateCronRulesUnitTestCase::runTest()
 
 
8 calls to UltimateCronRulesUnitTestCase::runTest()
  - UltimateCronRulesUnitTestCase::testRules in tests/rules.test
 
  
  - UltimateCronRulesUnitTestCase::testRules1MinuteRange in tests/rules.test
 
  
  - UltimateCronRulesUnitTestCase::testRules2MinuteRange in tests/rules.test
 
  
  - UltimateCronRulesUnitTestCase::testRules2MinuteRangeWithOffset in tests/rules.test
 
  
  - UltimateCronRulesUnitTestCase::testRules5MinuteRange in tests/rules.test
 
  
... See full list
 
File
 
   - tests/rules.test, line 63
 
  - Tests for Ultimate Cron's cron parser
 
  Class
  
  - UltimateCronRulesUnitTestCase 
 
  - @file
 
Code
private function runTest($options) {
  
  $options['rules'] = is_array($options['rules']) ? $options['rules'] : array(
    $options['rules'],
  );
  $options['catch_up'] = isset($options['catch_up']) ? $options['catch_up'] : 86400 * 365;
  
  $message = array();
  foreach ($options['rules'] as $rule) {
    $cron = CronRule::factory($rule, strtotime($options['now']));
    $intervals = $cron
      ->getIntervals();
    $parsed_rule = '';
    foreach ($intervals as $key => $value) {
      $parsed_rule .= "{$key}: " . implode(',', $value) . "\n";
    }
    
    $last_scheduled = $cron
      ->getLastSchedule();
    $message[] = "<span title=\"{$parsed_rule}\">{$rule}</span> @ " . date('Y-m-d H:i:s', $last_scheduled);
  }
  $message[] = 'now      @ ' . $options['now'];
  $message[] = 'last-run @ ' . $options['last_run'];
  $message[] = 'catch-up @ ' . $options['catch_up'];
  $message[] = ($options['result'] ? '' : 'not ') . 'expected to run';
  
  $result = UltimateCronCrontabScheduler::shouldRun($options['rules'], strtotime($options['last_run']), strtotime($options['now']), $options['catch_up']);
  return array(
    $options['result'] == $result,
    implode('<br/>', $message),
  );
}