Skip to content

Commit

Permalink
Merge pull request #211 from hubermat/add-test-for-issue-196
Browse files Browse the repository at this point in the history
Add test for issue #196
  • Loading branch information
u01jmg3 authored Mar 28, 2019
2 parents a7c91e6 + 7c4b9e9 commit d4a1c36
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
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

0 comments on commit d4a1c36

Please sign in to comment.