From 0d68fa3330836ba78e1ebac54ec3affd06b16699 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 25 Aug 2014 09:42:09 +0200 Subject: [PATCH] Support multiple CATEGORIES properties (#3497) --- plugins/libcalendaring/libvcalendar.php | 2 +- plugins/libcalendaring/tests/libvcalendar.php | 1 + plugins/libcalendaring/tests/resources/vtodo.ics | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php index a45da6e2..3cb7826f 100644 --- a/plugins/libcalendaring/libvcalendar.php +++ b/plugins/libcalendaring/libvcalendar.php @@ -471,7 +471,7 @@ class libvcalendar implements Iterator case 'CATEGORY': case 'CATEGORIES': - $event['categories'] = $prop->getParts(); + $event['categories'] = array_merge((array)$event['categories'], $prop->getParts()); break; case 'CLASS': diff --git a/plugins/libcalendaring/tests/libvcalendar.php b/plugins/libcalendaring/tests/libvcalendar.php index f5c61f91..aa2c5680 100644 --- a/plugins/libcalendaring/tests/libvcalendar.php +++ b/plugins/libcalendaring/tests/libvcalendar.php @@ -321,6 +321,7 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase $this->assertEquals('-1D:DISPLAY', $task['alarms'], "Taks alarm value"); $this->assertEquals('IN-PROCESS', $task['status'], "Task status property"); $this->assertEquals(1, count($task['x-custom']), "Custom properties"); + $this->assertEquals(4, count($task['categories'])); } /** diff --git a/plugins/libcalendaring/tests/resources/vtodo.ics b/plugins/libcalendaring/tests/resources/vtodo.ics index 95261420..0d4534c4 100644 --- a/plugins/libcalendaring/tests/resources/vtodo.ics +++ b/plugins/libcalendaring/tests/resources/vtodo.ics @@ -28,6 +28,9 @@ STATUS:IN-PROCESS DTSTART;TZID=Europe/Zurich:20130921T000000 DUE;VALUE=DATE:20130921 SEQUENCE:2 +CATEGORIES:Tag1,Tag2 +CATEGORIES:Tag3 +CATEGORIES:Tag4 X-MOZ-GENERATION:1 BEGIN:VALARM ACTION:DISPLAY