Skip to content

Commit

Permalink
Add new test for Bug: 12869
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Dec 6, 2013
1 parent 37b0ccb commit d106d33
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions framework/Date/test/Horde/Date/RecurrenceTest.php
Expand Up @@ -1045,4 +1045,34 @@ public function testRecurrenceObjectWithNonDefaultTimezones()
$this->assertEquals('America/New_York', $next->timezone);
}

public function testBug12869RecurrenceEndFromIcalendar()
{
date_default_timezone_set('Europe/Amsterdam');
$iCal = new Horde_Icalendar();
$iCal->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug12869.ics'));
$components = $iCal->getComponents();
foreach ($components as $content) {
if ($content instanceof Horde_Icalendar_Vevent) {
$start = new Horde_Date($content->getAttribute('DTSTART'));
$end = new Horde_Date($content->getAttribute('DTEND'));
$rrule = $content->getAttribute('RRULE');
$recurrence = new Horde_Date_Recurrence($start, $end);
$recurrence->fromRRule20($rrule);
break;
}
}

$after = array('year' => 2013, 'month' => 12);

$after['mday'] = 11;
$this->assertEquals('2013-12-12 13:45:00', (string)$recurrence->nextRecurrence($after));

$after['mday'] = 18;
$this->assertEquals('2013-12-19 13:45:00', (string)$recurrence->nextRecurrence($after));

$after['mday'] = 20;
$this->assertEquals('', (string)$recurrence->nextRecurrence($after));
date_default_timezone_set('Europe/Berlin');
}

}

0 comments on commit d106d33

Please sign in to comment.