Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for issue #196 #211

Merged
merged 8 commits into from
Mar 28, 2019
18 changes: 18 additions & 0 deletions tests/RecurrencesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,22 @@ public function testMonthlyFullDayTimeZoneBerlinFromFile() {
$checks);
}

public function testIssue196FromFile() {
$checks = array(
array('index' => 0, 'dateString' => '20191105T190000', 'timezone' => 'Europe/Berlin', 'message' => '1st event, CEST: '),
array('index' => 1, 'dateString' => '20191106T190000', 'timezone' => 'Europe/Berlin', 'message' => '2nd event, CEST: '),
array('index' => 2, 'dateString' => '20191107T190000', 'timezone' => 'Europe/Berlin', 'message' => '3rd event, CEST: '),
array('index' => 3, 'dateString' => '20191108T190000', 'timezone' => 'Europe/Berlin', 'message' => '4th event, CEST: '),
array('index' => 4, 'dateString' => '20191109T170000', 'timezone' => 'Europe/Berlin', 'message' => '5th event, CEST: '),
array('index' => 5, 'dateString' => '20191110T180000', 'timezone' => 'Europe/Berlin', 'message' => '6th event, CEST: '),
);
$this->assertEventFile(
'UTC',
"./tests/ical/issue-196.ics",
6,
$checks);
}

public function testWeeklyFullDayTimeZoneBerlin() {
$checks = array(
array('index' => 0, 'dateString' => '20000301', 'message' => '1st event, CET: '),
Expand Down Expand Up @@ -203,6 +219,8 @@ function assertEventFile($defaultTimezone, $file, $count, $checks) {

$this->assertCount($count, $events);

$events = $ical->sortEventsWithOrder($events);

foreach($checks as $check) {
$this->assertEvent($events[$check['index']], $check['dateString'], $check['message'], isset($check['timezone']) ? $check['timezone'] : $defaultTimezone);
}
Expand Down
64 changes: 64 additions & 0 deletions tests/ical/issue-196.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
VERSION:2.0
X-WR-CALNAME:Test-Calendar
X-WR-TIMEZONE:Europe/Berlin
BEGIN:VTIMEZONE
TZID:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20180101T152047Z
LAST-MODIFIED:20181202T202056Z
DTSTAMP:20181202T202056Z
UID:529b1ea3-8de8-484d-b878-c20c7fb72bf5
SUMMARY:test
RRULE:FREQ=DAILY;UNTIL=20191111T180000Z
DTSTART;TZID=Europe/Berlin:20191105T190000
DTEND;TZID=Europe/Berlin:20191105T220000
TRANSP:OPAQUE
SEQUENCE:24
X-MOZ-GENERATION:37
END:VEVENT
BEGIN:VEVENT
CREATED:20181202T202042Z
LAST-MODIFIED:20181202T202053Z
DTSTAMP:20181202T202053Z
UID:529b1ea3-8de8-484d-b878-c20c7fb72bf5
SUMMARY:test
RECURRENCE-ID;TZID=Europe/Berlin:20191109T190000
DTSTART;TZID=Europe/Berlin:20191109T170000
DTEND;TZID=Europe/Berlin:20191109T220000
TRANSP:OPAQUE
SEQUENCE:25
X-MOZ-GENERATION:37
DURATION:PT0S
END:VEVENT
BEGIN:VEVENT
CREATED:20181202T202053Z
LAST-MODIFIED:20181202T202056Z
DTSTAMP:20181202T202056Z
UID:529b1ea3-8de8-484d-b878-c20c7fb72bf5
SUMMARY:test
RECURRENCE-ID;TZID=Europe/Berlin:20191110T190000
DTSTART;TZID=Europe/Berlin:20191110T180000
DTEND;TZID=Europe/Berlin:20191110T220000
TRANSP:OPAQUE
SEQUENCE:25
X-MOZ-GENERATION:37
DURATION:PT0S
END:VEVENT
END:VCALENDAR