2 commits - plugins/libcalendaring

Thomas Brüderli bruederli at kolabsys.com
Thu Feb 6 10:55:35 CET 2014


 plugins/libcalendaring/libvcalendar.php                  |    4 -
 plugins/libcalendaring/tests/libvcalendar.php            |    5 ++
 plugins/libcalendaring/tests/resources/recurrence-id.ics |   31 +++++++++++++++
 3 files changed, 38 insertions(+), 2 deletions(-)

New commits:
commit 7d39a1808a041143d3829c8e38d3d3376948f384
Author: Thomas Bruederli <thomas at roundcube.net>
Date:   Thu Feb 6 10:55:25 2014 +0100

    Add unit test for commit 10f5a48

diff --git a/plugins/libcalendaring/tests/libvcalendar.php b/plugins/libcalendaring/tests/libvcalendar.php
index 0726c98..8526c5b 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 0000000..41485f9
--- /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


commit 10f5a485316c6df798c756c4e8518ac939c6ffc7
Author: Thomas Bruederli <thomas at roundcube.net>
Date:   Thu Feb 6 10:54:57 2014 +0100

    Add fallback to find VEVENT blocks with RECURRENCE-ID (#2792)

diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
index ea98d6f..3d9be7a 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -292,7 +292,7 @@ class libvcalendar implements Iterator
             $this->method = strval($vobject->METHOD);
             $this->agent  = strval($vobject->PRODID);
 
-            foreach ($vobject->getBaseComponents() as $ve) {
+            foreach ($vobject->getBaseComponents() ?: $vobject->getComponents() as $ve) {
                 if ($ve->name == 'VEVENT' || $ve->name == 'VTODO') {
                     // convert to hash array representation
                     $object = $this->_to_array($ve);
@@ -424,7 +424,7 @@ class libvcalendar implements Iterator
                 break;
 
             case 'RECURRENCE-ID':
-                // $event['recurrence_id'] = self::convert_datetime($prop);
+                $event['recurrence_date'] = self::convert_datetime($prop);
                 break;
 
             case 'RELATED-TO':




More information about the commits mailing list