Example #1
0
 public function testRecurrenceDSTSwitch()
 {
     // Recurring event starts 10/1/2011 15:00:00 EDST
     $l = new Horde_Test_Log();
     $logger = $l->getLogger();
     // Test Decoding
     $stream = fopen(__DIR__ . '/fixtures/dst.wbxml', 'r+');
     $decoder = new Horde_ActiveSync_Wbxml_Decoder($stream);
     $element = $decoder->getElementStartTag(Horde_ActiveSync::SYNC_DATA);
     $appt = new Horde_ActiveSync_Message_Appointment(array('logger' => $logger));
     $appt->decodeStream($decoder);
     fclose($stream);
     $decoder->getElementEndTag();
     $rrule = $appt->getRecurrence();
     // Get the next recurrence, still during EDST
     $next = $rrule->nextActiveRecurrence(new Horde_Date('2011-10-15'));
     $this->assertEquals('2011-10-15 15:00:00', (string) $next->setTimezone('America/New_York'));
     // Now get an occurence after the transition to EST.
     $next = $rrule->nextActiveRecurrence(new Horde_Date('2011-12-01'));
     $this->assertEquals('2011-12-10 15:00:00', (string) $next->setTimezone('America/New_York'));
 }