Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add currently failing test for Bug: 12843
- Loading branch information
Showing
3 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* @category Horde | ||
* @package Icalendar | ||
* @subpackage UnitTests | ||
*/ | ||
|
||
/** | ||
* @category Horde | ||
* @package Icalendar | ||
* @subpackage UnitTests | ||
*/ | ||
class Horde_Icalendar_DateTest extends Horde_Test_Case | ||
{ | ||
public function testDatesLocalTimezoneNotTheSame() | ||
{ | ||
$tz = date_default_timezone_get(); | ||
date_default_timezone_set('America/New_York'); | ||
$ical = new Horde_Icalendar(); | ||
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug12843.ics')); | ||
foreach ($ical->getComponents() as $component) { | ||
if ($component->getType() != 'vEvent') { | ||
continue; | ||
} | ||
$date_params = $component->getAttribute('DTSTART', true); | ||
$date = $component->getAttribute('DTSTART'); | ||
$start = new Horde_Date($date, $date_params[0]['TZID']); | ||
$this->assertEquals(18, $start->hour); | ||
} | ||
date_default_timezone_set($tz); | ||
} | ||
|
||
public function testDatesLocalTimezoneTheSame() | ||
{ | ||
$tz = date_default_timezone_get(); | ||
date_default_timezone_set('Europe/Berlin'); | ||
$ical = new Horde_Icalendar(); | ||
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug12843.ics')); | ||
foreach ($ical->getComponents() as $component) { | ||
if ($component->getType() != 'vEvent') { | ||
continue; | ||
} | ||
$date_params = $component->getAttribute('DTSTART', true); | ||
$date = $component->getAttribute('DTSTART'); | ||
$start = new Horde_Date($date, $date_params[0]['TZID']); | ||
$this->assertEquals(18, $start->hour); | ||
} | ||
date_default_timezone_set($tz); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
framework/Icalendar/test/Horde/Icalendar/fixtures/bug12843.ics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
PRODID:-//dmfs.org//mimedir.icalendar//EN | ||
BEGIN:VTIMEZONE | ||
TZID:Europe/Berlin | ||
X-LIC-LOCATION:Europe/Berlin | ||
BEGIN:DAYLIGHT | ||
TZOFFSETFROM:+0100 | ||
TZOFFSETTO:+0200 | ||
TZNAME:CEST | ||
DTSTART:19700329T020000 | ||
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU | ||
END:DAYLIGHT | ||
BEGIN:STANDARD | ||
TZOFFSETFROM:+0200 | ||
TZOFFSETTO:+0100 | ||
TZNAME:CET | ||
DTSTART:19701025T030000 | ||
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU | ||
END:STANDARD | ||
END:VTIMEZONE | ||
BEGIN:VEVENT | ||
DTSTART;TZID=Europe/Berlin:20131119T180000 | ||
DESCRIPTION:Some Description | ||
SUMMARY:CalDAV-Sync Test Event | ||
LOCATION:Some Location | ||
TRANSP:OPAQUE | ||
STATUS:CONFIRMED | ||
DTEND;TZID=Europe/Berlin:20131119T190000 | ||
LAST-MODIFIED:20131118T133721Z | ||
DTSTAMP:20131118T133721Z | ||
CREATED:20131118T133721Z | ||
UID:d9efd40a-39b5-4d62-9129-83ff649fa1a8 | ||
BEGIN:VALARM | ||
TRIGGER;VALUE=DURATION:-PT10M | ||
ACTION:DISPLAY | ||
DESCRIPTION:Default Event Notification | ||
X-WR-ALARMUID:45da49a7-9941-4ff9-8b27-b45c5c4c4c39 | ||
END:VALARM | ||
END:VEVENT | ||
END:VCALENDAR |