Branch 'dev/sabre-vobject3' - plugins/libcalendaring
Thomas Brüderli
bruederli at kolabsys.com
Mon Nov 10 17:56:16 CET 2014
plugins/libcalendaring/tests/libvcalendar.php | 25 ++++++++++++++++---
plugins/libcalendaring/tests/resources/itip.ics | 4 ++-
plugins/libcalendaring/tests/resources/recurring.ics | 8 ++++++
3 files changed, 33 insertions(+), 4 deletions(-)
New commits:
commit 756121c7adf57c5df8d50a969dcae30d7908791e
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Mon Nov 10 17:56:11 2014 +0100
Add some more tests for ical parsing
diff --git a/plugins/libcalendaring/tests/libvcalendar.php b/plugins/libcalendaring/tests/libvcalendar.php
index c247def..eff827c 100644
--- a/plugins/libcalendaring/tests/libvcalendar.php
+++ b/plugins/libcalendaring/tests/libvcalendar.php
@@ -124,7 +124,7 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase
$this->assertEquals('REQUEST', $ical->method, "iTip method");
// attendees
- $this->assertEquals(2, count($event['attendees']), "Attendees list (including organizer)");
+ $this->assertEquals(3, count($event['attendees']), "Attendees list (including organizer)");
$organizer = $event['attendees'][0];
$this->assertEquals('ORGANIZER', $organizer['role'], 'Organizer ROLE');
$this->assertEquals('Rolf Test', $organizer['name'], 'Organizer name');
@@ -133,8 +133,17 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase
$this->assertEquals('REQ-PARTICIPANT', $attendee['role'], 'Attendee ROLE');
$this->assertEquals('NEEDS-ACTION', $attendee['status'], 'Attendee STATUS');
$this->assertEquals('rolf2 at mykolab.com', $attendee['email'], 'Attendee mailto:');
+ $this->assertEquals('carl at mykolab.com', $attendee['delegated-from'], 'Attendee delegated-from');
$this->assertTrue($attendee['rsvp'], 'Attendee RSVP');
+ $delegator = $event['attendees'][2];
+ $this->assertEquals('NON-PARTICIPANT', $delegator['role'], 'Delegator ROLE');
+ $this->assertEquals('DELEGATED', $delegator['status'], 'Delegator STATUS');
+ $this->assertEquals('INDIVIDUAL', $delegator['cutype'], 'Delegator CUTYPE');
+ $this->assertEquals('carl at mykolab.com', $delegator['email'], 'Delegator mailto:');
+ $this->assertEquals('rolf2 at mykolab.com', $delegator['delegated-to'], 'Delegator delegated-to');
+ $this->assertFalse($delegator['rsvp'], 'Delegator RSVP');
+
// attachments
$this->assertEquals(1, count($event['attachments']), "Embedded attachments");
$attachment = $event['attachments'][0];
@@ -156,6 +165,14 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase
$this->assertEquals(2, count($rrule['EXDATE']), "Recurrence EXDATEs");
$this->assertInstanceOf('DateTime', $rrule['EXDATE'][0], "Recurrence EXDATE as DateTime");
+ $this->assertTrue(is_array($rrule['EXCEPTIONS']));
+ $this->assertEquals(1, count($rrule['EXCEPTIONS']), "Recurrence Exceptions");
+
+ $exception = $rrule['EXCEPTIONS'][0];
+ $this->assertEquals($event['uid'], $event['uid'], "Exception UID");
+ $this->assertEquals('Recurring Test (Exception)', $exception['title'], "Exception title");
+ $this->assertInstanceOf('DateTime', $exception['start'], "Exception start");
+
// categories, class
$this->assertEquals('libcalendaring tests', join(',', (array)$event['categories']), "Event categories");
$this->assertEquals('confidential', $event['sensitivity'], "Class/sensitivity = confidential");
@@ -364,11 +381,11 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase
$this->assertContains('SEQUENCE:' . $event['sequence'], $ics, "Export Sequence number");
$this->assertContains('CLASS:CONFIDENTIAL', $ics, "Sensitivity => Class");
$this->assertContains('DESCRIPTION:*Exported by', $ics, "Export Description");
- $this->assertContains('ORGANIZER;CN=Rolf Test:mailto:rolf@', $ics, "Export organizer");
+ $this->assertContains('ORGANIZER;CN=Rolf Test:mailto:rolf@', $ics, "Export organizer");
$this->assertRegExp('/ATTENDEE.*;ROLE=REQ-PARTICIPANT/', $ics, "Export Attendee ROLE");
$this->assertRegExp('/ATTENDEE.*;PARTSTAT=NEEDS-ACTION/', $ics, "Export Attendee Status");
$this->assertRegExp('/ATTENDEE.*;RSVP=TRUE/', $ics, "Export Attendee RSVP");
- $this->assertRegExp('/ATTENDEE.*:mailto:rolf2@/', $ics, "Export Attendee mailto:");
+ $this->assertRegExp('/:mailto:rolf2@/', $ics, "Export Attendee mailto:");
$rrule = $event['recurrence'];
$this->assertRegExp('/RRULE:.*FREQ='.$rrule['FREQ'].'/', $ics, "Export Recurrence Frequence");
@@ -420,6 +437,8 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase
// add exceptions
$event = $events[0];
+ unset($event['recurrence']['EXCEPTIONS']);
+
$exception1 = $event;
$exception1['start'] = clone $event['start'];
$exception1['start']->setDate(2013, 8, 14);
diff --git a/plugins/libcalendaring/tests/resources/itip.ics b/plugins/libcalendaring/tests/resources/itip.ics
index af283e3..50eb4ee 100644
--- a/plugins/libcalendaring/tests/resources/itip.ics
+++ b/plugins/libcalendaring/tests/resources/itip.ics
@@ -7,7 +7,9 @@ BEGIN:VEVENT
ORGANIZER;CN="Rolf Test":MAILTO:rolf at mykolab.com
DTSTAMP:20130628T190056Z
ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;
- X-UID=208889384:mailto:rolf2 at mykolab.com
+ DELEGATED-FROM=carl at mykolab.com;X-UID=208889384:mailto:rolf2 at mykolab.com
+ATTENDEE;RSVP=FALSE;PARTSTAT=DELEGATED;ROLE=NON-PARTICIPANT;CUTYPE=INDIVIDUAL;
+ DELEGATED-TO=rolf2 at mykolab.com:mailto:carl at mykolab.com
CREATED:20130628T190032Z
UID:ac6b0aee-2519-4e5c-9a25-48c57064c9f0
LAST-MODIFIED:20130628T190032Z
diff --git a/plugins/libcalendaring/tests/resources/recurring.ics b/plugins/libcalendaring/tests/resources/recurring.ics
index 92db9e2..85860be 100644
--- a/plugins/libcalendaring/tests/resources/recurring.ics
+++ b/plugins/libcalendaring/tests/resources/recurring.ics
@@ -40,4 +40,12 @@ TRIGGER:-PT12H
ACTION:DISPLAY
END:VALARM
END:VEVENT
+BEGIN:VEVENT
+DTSTART;TZID="Europe/Zurich":20140521T100000
+DTEND;TZID="Europe/Zurich":20140521T150000
+RECURRENCE-ID:20140521T080000Z
+UID:7e93e8e8eef16f28aa33b78cd73613eb
+DTSTAMP:20130718T082032Z
+SUMMARY:Recurring Test (Exception)
+END:VEVENT
END:VCALENDAR
More information about the commits
mailing list