Skip to content

Commit

Permalink
Add currently failing test for Bug: 12843
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Feb 11, 2014
1 parent 75657c7 commit 29ee350
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 3 deletions.
9 changes: 6 additions & 3 deletions framework/Icalendar/package.xml
Expand Up @@ -23,8 +23,7 @@
<email>mrubinsk@horde.org</email>
<active>yes</active>
</developer>
<date>2013-07-16</date>
<time>19:27:35</time>
<date>2014-02-11</date>
<version>
<release>2.0.8</release>
<api>1.1.0</api>
Expand Down Expand Up @@ -381,6 +380,7 @@
<file name="wicca.txt" role="test" />
</dir> <!-- /test/Horde/Icalendar/fixtures/vTimezone -->
<file name="bug7423.ics" role="test" />
<file name="bug12843.ics" role="test" />
<file name="charset1.ics" role="test" />
<file name="charset2.ics" role="test" />
<file name="charset3.ics" role="test" />
Expand All @@ -406,6 +406,7 @@
<file name="AttributeTest.php" role="test" />
<file name="bootstrap.php" role="test" />
<file name="CharsetTest.php" role="test" />
<file name="DateTest.php" role="test" />
<file name="ExportTest.php" role="test" />
<file name="FreeBusyTest.php" role="test" />
<file name="ParseTest.php" role="test" />
Expand Down Expand Up @@ -597,12 +598,14 @@
<install as="Horde/Icalendar/AttributeTest.php" name="test/Horde/Icalendar/AttributeTest.php" />
<install as="Horde/Icalendar/bootstrap.php" name="test/Horde/Icalendar/bootstrap.php" />
<install as="Horde/Icalendar/CharsetTest.php" name="test/Horde/Icalendar/CharsetTest.php" />
<install as="Horde/Icalendar/DateTest.php" name="test/Horde/Icalendar/DateTest.php" />
<install as="Horde/Icalendar/ExportTest.php" name="test/Horde/Icalendar/ExportTest.php" />
<install as="Horde/Icalendar/FreeBusyTest.php" name="test/Horde/Icalendar/FreeBusyTest.php" />
<install as="Horde/Icalendar/ParseTest.php" name="test/Horde/Icalendar/ParseTest.php" />
<install as="Horde/Icalendar/phpunit.xml" name="test/Horde/Icalendar/phpunit.xml" />
<install as="Horde/Icalendar/TimezonesTest.php" name="test/Horde/Icalendar/TimezonesTest.php" />
<install as="Horde/Icalendar/fixtures/bug7423.ics" name="test/Horde/Icalendar/fixtures/bug7423.ics" />
<install as="Horde/Icalendar/fixtures/bug12843.ics" name="test/Horde/Icalendar/fixtures/bug12843.ics" />
<install as="Horde/Icalendar/fixtures/charset1.ics" name="test/Horde/Icalendar/fixtures/charset1.ics" />
<install as="Horde/Icalendar/fixtures/charset2.ics" name="test/Horde/Icalendar/fixtures/charset2.ics" />
<install as="Horde/Icalendar/fixtures/charset3.ics" name="test/Horde/Icalendar/fixtures/charset3.ics" />
Expand Down Expand Up @@ -1119,7 +1122,7 @@ Lots of improvements, bugfixes and support for more fields and members of the iC
<stability>
<release>stable</release>
<api>stable</api></stability>
<date>2013-07-16</date>
<date>2014-02-11</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
Expand Down
50 changes: 50 additions & 0 deletions framework/Icalendar/test/Horde/Icalendar/DateTest.php
@@ -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 framework/Icalendar/test/Horde/Icalendar/fixtures/bug12843.ics
@@ -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

0 comments on commit 29ee350

Please sign in to comment.