protected function runselftest($default, &$arr_rrule, $expected = array(), $inf = false) { $rrule = new CalendarRecurRule($arr_rrule); $results = array(); $max = mktime(0, 0, 0, 1, 1, 2020); if (NULL === $rrule->GetCount()) { $rrule->SetCount(600); } $rrule->Recur($results, $default, $max); if (empty($expected) || array_key_exists('debug', $rrule)) { echo '<pre>' . "\n\n"; foreach ($results as $k => $result) { echo $k . ' => ' . $result . ', '; if ($k % 10 == 9) { echo "\n"; } } echo "\n\n"; foreach ($results as $result) { echo date(DATE_RFC822, $result) . "\n"; } echo "\n\n" . '</pre>'; return 2; } foreach ($results as $k => $v) { if (!array_key_exists($k, $expected) || $expected[$k] !== $v) { return 1; } } foreach ($expected as $k => $v) { if (!array_key_exists($k, $results) || $results[$k] !== $v) { return 1; } } return 0; }