From 7d39a1808a041143d3829c8e38d3d3376948f384 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 6 Feb 2014 10:55:25 +0100 Subject: [PATCH] Add unit test for commit 10f5a48 --- plugins/libcalendaring/tests/libvcalendar.php | 5 +++ .../tests/resources/recurrence-id.ics | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 plugins/libcalendaring/tests/resources/recurrence-id.ics diff --git a/plugins/libcalendaring/tests/libvcalendar.php b/plugins/libcalendaring/tests/libvcalendar.php index 0726c98a..8526c5b4 100644 --- a/plugins/libcalendaring/tests/libvcalendar.php +++ b/plugins/libcalendaring/tests/libvcalendar.php @@ -142,6 +142,11 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase // categories, class $this->assertEquals('libcalendaring tests', join(',', (array)$event['categories']), "Event categories"); $this->assertEquals('confidential', $event['sensitivity'], "Class/sensitivity = confidential"); + + // parse a reccuence chain instance + $events = $ical->import_from_file(__DIR__ . '/resources/recurrence-id.ics', 'UTF-8'); + $this->assertEquals(1, count($events), "Fall back to Component::getComponents() when getBaseComponents() is empty"); + $this->assertInstanceOf('DateTime', $events[0]['recurrence_date'], "Recurrence-ID as date"); } /** diff --git a/plugins/libcalendaring/tests/resources/recurrence-id.ics b/plugins/libcalendaring/tests/resources/recurrence-id.ics new file mode 100644 index 00000000..41485f9d --- /dev/null +++ b/plugins/libcalendaring/tests/resources/recurrence-id.ics @@ -0,0 +1,31 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//Lotus Development Corporation//NONSGML Notes 8.5.3//EN_C +METHOD:REQUEST +BEGIN:VTIMEZONE +TZID:W. Europe +BEGIN:STANDARD +DTSTART:19501029T020000 +TZOFFSETFROM:+0200 +TZOFFSETTO:+0100 +RRULE:FREQ=YEARLY;BYMINUTE=0;BYHOUR=2;BYDAY=-1SU;BYMONTH=10 +END:STANDARD +BEGIN:DAYLIGHT +DTSTART:19500326T020000 +TZOFFSETFROM:+0100 +TZOFFSETTO:+0200 +RRULE:FREQ=YEARLY;BYMINUTE=0;BYHOUR=2;BYDAY=-1SU;BYMONTH=3 +END:DAYLIGHT +END:VTIMEZONE +BEGIN:VEVENT +DTSTART;TZID="W. Europe":20140230T150000 +DTEND;TZID="W. Europe":20140230T163000 +TRANSP:OPAQUE +RDATE;TZID="W. Europe";VALUE=PERIOD:20140227T140000/20140227T153000 +RECURRENCE-ID:20140227T130000Z +SEQUENCE:0 +UID:7e93e8e8eef16f28aa33b78cd73613ebff +DTSTAMP:20140120T105609Z +SUMMARY:Invitation with Recurrence-ID +END:VEVENT +END:VCALENDAR