예제 #1
0
 public function testGenerateMonthlyMonthly()
 {
     $repetition = new Duration();
     $repetition->setRepeatPeriod($repetition::REPEAT_MONTHLY);
     $repetition->setRepeatMonthBy($repetition::MONTHLY_REPEAT_MONTHLY);
     $repetition->setRepeatEveryNum(3);
     $repetition->setStartDate('1/14/2015 1:00:00');
     $repetition->setEndDate('1/14/2015 3:00:00');
     $now = strtotime('2/13/2014');
     $end = strtotime('+5 years', $now);
     $occurrences = $repetition->activeRangesBetween($now, $end);
     $all_active = true;
     foreach ($occurrences as $occurrence) {
         $window = $repetition->getActiveRange($occurrence[0]);
         if (!$window) {
             $all_active = false;
             break;
         }
         if ($window[0] != $occurrence[0] || $window[1] != $occurrence[1]) {
             $all_active = false;
             break;
         }
     }
     $this->assertTrue($all_active, 'EventOccurrenceFactory generated inactive occurrences.');
 }