예제 #1
0
 public function testGenerateSingle()
 {
     $now = strtotime('2/13/2014');
     $repetition = new Duration();
     $repetition->setStartDate(date('Y-m-d H:i:s', $now));
     $repetition->setEndDate(date('Y-m-d H:i:s', $now + 86400));
     $occurrences = $repetition->activeRangesBetween($now, strtotime('+5 years', $now));
     $this->assertNotEmpty($occurrences);
     $this->assertEquals(1, count($occurrences));
     $occurrence = $occurrences[0];
     $this->assertEquals(strtotime($repetition->getStartDate()), $occurrence[0]);
     $this->assertEquals(strtotime($repetition->getEndDate()), $occurrence[1]);
     $repetition->setEndDate(null);
     $this->assertTrue($repetition->isActive($now));
 }