Add some more tests for ical parsing
This commit is contained in:
parent
c739e047c1
commit
756121c7ad
3 changed files with 33 additions and 4 deletions
|
@ -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@mykolab.com', $attendee['email'], 'Attendee mailto:');
|
||||
$this->assertEquals('carl@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@mykolab.com', $delegator['email'], 'Delegator mailto:');
|
||||
$this->assertEquals('rolf2@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);
|
||||
|
|
|
@ -7,7 +7,9 @@ BEGIN:VEVENT
|
|||
ORGANIZER;CN="Rolf Test":MAILTO:rolf@mykolab.com
|
||||
DTSTAMP:20130628T190056Z
|
||||
ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;
|
||||
X-UID=208889384:mailto:rolf2@mykolab.com
|
||||
DELEGATED-FROM=carl@mykolab.com;X-UID=208889384:mailto:rolf2@mykolab.com
|
||||
ATTENDEE;RSVP=FALSE;PARTSTAT=DELEGATED;ROLE=NON-PARTICIPANT;CUTYPE=INDIVIDUAL;
|
||||
DELEGATED-TO=rolf2@mykolab.com:mailto:carl@mykolab.com
|
||||
CREATED:20130628T190032Z
|
||||
UID:ac6b0aee-2519-4e5c-9a25-48c57064c9f0
|
||||
LAST-MODIFIED:20130628T190032Z
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue