1<?php
2
3namespace Sabre\VObject\ITip;
4
5class BrokerUpdateTest extends BrokerTester {
6
7    function testInviteChange() {
8
9        $oldMessage = <<<ICS
10BEGIN:VCALENDAR
11VERSION:2.0
12BEGIN:VEVENT
13UID:foobar
14SEQUENCE:1
15SUMMARY:foo
16ORGANIZER;CN=Strunk:mailto:strunk@example.org
17ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
18ATTENDEE;CN=One:mailto:one@example.org
19ATTENDEE;CN=Two:mailto:two@example.org
20DTSTART:20140716T120000Z
21DTEND:20140716T130000Z
22END:VEVENT
23END:VCALENDAR
24ICS;
25
26
27        $newMessage = <<<ICS
28BEGIN:VCALENDAR
29VERSION:2.0
30BEGIN:VEVENT
31UID:foobar
32SEQUENCE:2
33SUMMARY:foo
34ORGANIZER;CN=Strunk:mailto:strunk@example.org
35ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
36ATTENDEE;CN=Two:mailto:two@example.org
37ATTENDEE;CN=Three:mailto:three@example.org
38DTSTART:20140716T120000Z
39DTEND:20140716T130000Z
40END:VEVENT
41END:VCALENDAR
42ICS;
43
44        $version = \Sabre\VObject\Version::VERSION;
45
46        $expected = array(
47            array(
48                'uid' => 'foobar',
49                'method' => 'CANCEL',
50                'component' => 'VEVENT',
51                'sender' => 'mailto:strunk@example.org',
52                'senderName' => 'Strunk',
53                'recipient' => 'mailto:one@example.org',
54                'recipientName' => 'One',
55                'significantChange' => true,
56                'message' => <<<ICS
57BEGIN:VCALENDAR
58VERSION:2.0
59PRODID:-//Sabre//Sabre VObject $version//EN
60CALSCALE:GREGORIAN
61METHOD:CANCEL
62BEGIN:VEVENT
63UID:foobar
64SEQUENCE:2
65SUMMARY:foo
66DTSTART:20140716T120000Z
67DTEND:20140716T130000Z
68ORGANIZER;CN=Strunk:mailto:strunk@example.org
69ATTENDEE;CN=One:mailto:one@example.org
70END:VEVENT
71END:VCALENDAR
72ICS
73
74            ),
75            array(
76                'uid' => 'foobar',
77                'method' => 'REQUEST',
78                'component' => 'VEVENT',
79                'sender' => 'mailto:strunk@example.org',
80                'senderName' => 'Strunk',
81                'recipient' => 'mailto:two@example.org',
82                'recipientName' => 'Two',
83                'significantChange' => false,
84                'message' => <<<ICS
85BEGIN:VCALENDAR
86VERSION:2.0
87PRODID:-//Sabre//Sabre VObject $version//EN
88CALSCALE:GREGORIAN
89METHOD:REQUEST
90BEGIN:VEVENT
91UID:foobar
92SEQUENCE:2
93SUMMARY:foo
94ORGANIZER;CN=Strunk:mailto:strunk@example.org
95ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
96ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
97ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
98DTSTART:20140716T120000Z
99DTEND:20140716T130000Z
100END:VEVENT
101END:VCALENDAR
102ICS
103
104            ),
105            array(
106                'uid' => 'foobar',
107                'method' => 'REQUEST',
108                'component' => 'VEVENT',
109                'sender' => 'mailto:strunk@example.org',
110                'senderName' => 'Strunk',
111                'recipient' => 'mailto:three@example.org',
112                'recipientName' => 'Three',
113                'significantChange' => true,
114                'message' => <<<ICS
115BEGIN:VCALENDAR
116VERSION:2.0
117PRODID:-//Sabre//Sabre VObject $version//EN
118CALSCALE:GREGORIAN
119METHOD:REQUEST
120BEGIN:VEVENT
121UID:foobar
122SEQUENCE:2
123SUMMARY:foo
124ORGANIZER;CN=Strunk:mailto:strunk@example.org
125ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
126ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
127ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
128DTSTART:20140716T120000Z
129DTEND:20140716T130000Z
130END:VEVENT
131END:VCALENDAR
132ICS
133
134            ),
135        );
136
137        $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
138
139    }
140
141    function testInviteChangeFromNonSchedulingToSchedulingObject() {
142
143        $oldMessage = <<<ICS
144BEGIN:VCALENDAR
145VERSION:2.0
146BEGIN:VEVENT
147UID:foobar
148SEQUENCE:1
149DTSTART:20140716T120000Z
150DTEND:20140716T130000Z
151END:VEVENT
152END:VCALENDAR
153ICS;
154
155
156        $newMessage = <<<ICS
157BEGIN:VCALENDAR
158VERSION:2.0
159BEGIN:VEVENT
160UID:foobar
161SEQUENCE:2
162ORGANIZER;CN=Strunk:mailto:strunk@example.org
163ATTENDEE;CN=One:mailto:one@example.org
164DTSTART:20140716T120000Z
165DTEND:20140716T130000Z
166END:VEVENT
167END:VCALENDAR
168ICS;
169
170        $version = \Sabre\VObject\Version::VERSION;
171
172        $expected = array(
173            array(
174                'uid' => 'foobar',
175                'method' => 'REQUEST',
176                'component' => 'VEVENT',
177                'sender' => 'mailto:strunk@example.org',
178                'senderName' => 'Strunk',
179                'recipient' => 'mailto:one@example.org',
180                'recipientName' => 'One',
181                'message' => <<<ICS
182BEGIN:VCALENDAR
183VERSION:2.0
184PRODID:-//Sabre//Sabre VObject $version//EN
185CALSCALE:GREGORIAN
186METHOD:REQUEST
187BEGIN:VEVENT
188UID:foobar
189SEQUENCE:2
190ORGANIZER;CN=Strunk:mailto:strunk@example.org
191ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
192DTSTART:20140716T120000Z
193DTEND:20140716T130000Z
194END:VEVENT
195END:VCALENDAR
196ICS
197
198            ),
199
200        );
201
202        $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
203
204    }
205
206    function testInviteChangeFromSchedulingToNonSchedulingObject() {
207
208        $oldMessage = <<<ICS
209BEGIN:VCALENDAR
210VERSION:2.0
211BEGIN:VEVENT
212UID:foobar
213SEQUENCE:2
214ORGANIZER;CN=Strunk:mailto:strunk@example.org
215ATTENDEE;CN=One:mailto:one@example.org
216DTSTART:20140716T120000Z
217DTEND:20140716T130000Z
218END:VEVENT
219END:VCALENDAR
220ICS;
221
222
223        $newMessage = <<<ICS
224BEGIN:VCALENDAR
225VERSION:2.0
226BEGIN:VEVENT
227UID:foobar
228SEQUENCE:1
229DTSTART:20140716T120000Z
230DTEND:20140716T130000Z
231END:VEVENT
232END:VCALENDAR
233ICS;
234
235        $version = \Sabre\VObject\Version::VERSION;
236
237        $expected = array(
238            array(
239                'uid' => 'foobar',
240                'method' => 'CANCEL',
241                'component' => 'VEVENT',
242                'message' => <<<ICS
243BEGIN:VCALENDAR
244VERSION:2.0
245PRODID:-//Sabre//Sabre VObject $version//EN
246CALSCALE:GREGORIAN
247METHOD:CANCEL
248BEGIN:VEVENT
249UID:foobar
250SEQUENCE:1
251DTSTART:20140716T120000Z
252DTEND:20140716T130000Z
253ORGANIZER;CN=Strunk:mailto:strunk@example.org
254ATTENDEE;CN=One:mailto:one@example.org
255END:VEVENT
256END:VCALENDAR
257ICS
258
259            ),
260
261        );
262
263        $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
264
265    }
266
267    function testNoAttendees() {
268
269        $oldMessage = <<<ICS
270BEGIN:VCALENDAR
271VERSION:2.0
272BEGIN:VEVENT
273UID:foobar
274SEQUENCE:1
275DTSTART:20140716T120000Z
276DTEND:20140716T130000Z
277END:VEVENT
278END:VCALENDAR
279ICS;
280
281
282        $newMessage = <<<ICS
283BEGIN:VCALENDAR
284VERSION:2.0
285BEGIN:VEVENT
286UID:foobar
287SEQUENCE:2
288DTSTART:20140716T120000Z
289DTEND:20140716T130000Z
290END:VEVENT
291END:VCALENDAR
292ICS;
293
294        $version = \Sabre\VObject\Version::VERSION;
295
296        $expected = array();
297        $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
298
299    }
300
301    function testRemoveInstance() {
302
303        $oldMessage = <<<ICS
304BEGIN:VCALENDAR
305VERSION:2.0
306BEGIN:VEVENT
307UID:foobar
308SEQUENCE:1
309ORGANIZER;CN=Strunk:mailto:strunk@example.org
310ATTENDEE;CN=One:mailto:one@example.org
311DTSTART;TZID=America/Toronto:20140716T120000
312DTEND;TZID=America/Toronto:20140716T130000
313RRULE:FREQ=WEEKLY
314END:VEVENT
315END:VCALENDAR
316ICS;
317
318
319        $newMessage = <<<ICS
320BEGIN:VCALENDAR
321VERSION:2.0
322BEGIN:VEVENT
323UID:foobar
324SEQUENCE:2
325ORGANIZER;CN=Strunk:mailto:strunk@example.org
326ATTENDEE;CN=One:mailto:one@example.org
327DTSTART;TZID=America/Toronto:20140716T120000
328DTEND;TZID=America/Toronto:20140716T130000
329RRULE:FREQ=WEEKLY
330EXDATE;TZID=America/Toronto:20140724T120000
331END:VEVENT
332END:VCALENDAR
333ICS;
334
335        $version = \Sabre\VObject\Version::VERSION;
336
337        $expected = array(
338            array(
339                'uid' => 'foobar',
340                'method' => 'REQUEST',
341                'component' => 'VEVENT',
342                'sender' => 'mailto:strunk@example.org',
343                'senderName' => 'Strunk',
344                'recipient' => 'mailto:one@example.org',
345                'recipientName' => 'One',
346                'message' => <<<ICS
347BEGIN:VCALENDAR
348VERSION:2.0
349PRODID:-//Sabre//Sabre VObject $version//EN
350CALSCALE:GREGORIAN
351METHOD:REQUEST
352BEGIN:VEVENT
353UID:foobar
354SEQUENCE:2
355ORGANIZER;CN=Strunk:mailto:strunk@example.org
356ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
357DTSTART;TZID=America/Toronto:20140716T120000
358DTEND;TZID=America/Toronto:20140716T130000
359RRULE:FREQ=WEEKLY
360EXDATE;TZID=America/Toronto:20140724T120000
361END:VEVENT
362END:VCALENDAR
363ICS
364
365            ),
366        );
367
368        $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
369
370    }
371
372    /**
373     * This test is identical to the first test, except this time we change the
374     * DURATION property.
375     *
376     * This should ensure that the message is significant for every attendee,
377     */
378    function testInviteChangeSignificantChange() {
379
380        $oldMessage = <<<ICS
381BEGIN:VCALENDAR
382VERSION:2.0
383BEGIN:VEVENT
384UID:foobar
385DURATION:PT1H
386SEQUENCE:1
387ORGANIZER;CN=Strunk:mailto:strunk@example.org
388ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
389ATTENDEE;CN=One:mailto:one@example.org
390ATTENDEE;CN=Two:mailto:two@example.org
391DTSTART:20140716T120000Z
392DTEND:20140716T130000Z
393END:VEVENT
394END:VCALENDAR
395ICS;
396
397
398        $newMessage = <<<ICS
399BEGIN:VCALENDAR
400VERSION:2.0
401BEGIN:VEVENT
402UID:foobar
403DURATION:PT2H
404SEQUENCE:2
405ORGANIZER;CN=Strunk:mailto:strunk@example.org
406ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
407ATTENDEE;CN=Two:mailto:two@example.org
408ATTENDEE;CN=Three:mailto:three@example.org
409DTSTART:20140716T120000Z
410DTEND:20140716T130000Z
411END:VEVENT
412END:VCALENDAR
413ICS;
414
415        $version = \Sabre\VObject\Version::VERSION;
416
417        $expected = array(
418            array(
419                'uid' => 'foobar',
420                'method' => 'CANCEL',
421                'component' => 'VEVENT',
422                'sender' => 'mailto:strunk@example.org',
423                'senderName' => 'Strunk',
424                'recipient' => 'mailto:one@example.org',
425                'recipientName' => 'One',
426                'significantChange' => true,
427                'message' => <<<ICS
428BEGIN:VCALENDAR
429VERSION:2.0
430PRODID:-//Sabre//Sabre VObject $version//EN
431CALSCALE:GREGORIAN
432METHOD:CANCEL
433BEGIN:VEVENT
434UID:foobar
435SEQUENCE:2
436DTSTART:20140716T120000Z
437DTEND:20140716T130000Z
438ORGANIZER;CN=Strunk:mailto:strunk@example.org
439ATTENDEE;CN=One:mailto:one@example.org
440END:VEVENT
441END:VCALENDAR
442ICS
443
444            ),
445            array(
446                'uid' => 'foobar',
447                'method' => 'REQUEST',
448                'component' => 'VEVENT',
449                'sender' => 'mailto:strunk@example.org',
450                'senderName' => 'Strunk',
451                'recipient' => 'mailto:two@example.org',
452                'recipientName' => 'Two',
453                'significantChange' => true,
454                'message' => <<<ICS
455BEGIN:VCALENDAR
456VERSION:2.0
457PRODID:-//Sabre//Sabre VObject $version//EN
458CALSCALE:GREGORIAN
459METHOD:REQUEST
460BEGIN:VEVENT
461UID:foobar
462DURATION:PT2H
463SEQUENCE:2
464ORGANIZER;CN=Strunk:mailto:strunk@example.org
465ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
466ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
467ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
468DTSTART:20140716T120000Z
469DTEND:20140716T130000Z
470END:VEVENT
471END:VCALENDAR
472ICS
473
474            ),
475            array(
476                'uid' => 'foobar',
477                'method' => 'REQUEST',
478                'component' => 'VEVENT',
479                'sender' => 'mailto:strunk@example.org',
480                'senderName' => 'Strunk',
481                'recipient' => 'mailto:three@example.org',
482                'recipientName' => 'Three',
483                'significantChange' => true,
484                'message' => <<<ICS
485BEGIN:VCALENDAR
486VERSION:2.0
487PRODID:-//Sabre//Sabre VObject $version//EN
488CALSCALE:GREGORIAN
489METHOD:REQUEST
490BEGIN:VEVENT
491UID:foobar
492DURATION:PT2H
493SEQUENCE:2
494ORGANIZER;CN=Strunk:mailto:strunk@example.org
495ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
496ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
497ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
498DTSTART:20140716T120000Z
499DTEND:20140716T130000Z
500END:VEVENT
501END:VCALENDAR
502ICS
503
504            ),
505        );
506
507        $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
508
509    }
510
511    function testInviteNoChange() {
512
513        $oldMessage = <<<ICS
514BEGIN:VCALENDAR
515VERSION:2.0
516BEGIN:VEVENT
517UID:foobar
518SEQUENCE:1
519ORGANIZER;CN=Strunk:mailto:strunk@example.org
520ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
521ATTENDEE;CN=One:mailto:one@example.org
522DTSTART:20140716T120000Z
523DTEND:20140716T130000Z
524END:VEVENT
525END:VCALENDAR
526ICS;
527
528
529        $newMessage = <<<ICS
530BEGIN:VCALENDAR
531VERSION:2.0
532BEGIN:VEVENT
533UID:foobar
534SEQUENCE:2
535ORGANIZER;CN=Strunk:mailto:strunk@example.org
536ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
537ATTENDEE;CN=One:mailto:one@example.org
538DTSTART:20140716T120000Z
539DTEND:20140716T130000Z
540END:VEVENT
541END:VCALENDAR
542ICS;
543
544        $version = \Sabre\VObject\Version::VERSION;
545
546        $expected = array(
547            array(
548                'uid' => 'foobar',
549                'method' => 'REQUEST',
550                'component' => 'VEVENT',
551                'sender' => 'mailto:strunk@example.org',
552                'senderName' => 'Strunk',
553                'recipient' => 'mailto:one@example.org',
554                'recipientName' => 'One',
555                'significantChange' => false,
556                'message' => <<<ICS
557BEGIN:VCALENDAR
558VERSION:2.0
559PRODID:-//Sabre//Sabre VObject $version//EN
560CALSCALE:GREGORIAN
561METHOD:REQUEST
562BEGIN:VEVENT
563UID:foobar
564SEQUENCE:2
565ORGANIZER;CN=Strunk:mailto:strunk@example.org
566ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
567ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
568DTSTART:20140716T120000Z
569DTEND:20140716T130000Z
570END:VEVENT
571END:VCALENDAR
572ICS
573
574            ),
575
576        );
577
578        $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
579
580    }
581
582    function testInviteNoChangeForceSend() {
583
584        $oldMessage = <<<ICS
585BEGIN:VCALENDAR
586VERSION:2.0
587BEGIN:VEVENT
588UID:foobar
589SEQUENCE:1
590ORGANIZER;CN=Strunk:mailto:strunk@example.org
591ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
592ATTENDEE;CN=One:mailto:one@example.org
593DTSTART:20140716T120000Z
594DTEND:20140716T130000Z
595END:VEVENT
596END:VCALENDAR
597ICS;
598
599
600        $newMessage = <<<ICS
601BEGIN:VCALENDAR
602VERSION:2.0
603BEGIN:VEVENT
604UID:foobar
605SEQUENCE:2
606ORGANIZER;CN=Strunk:mailto:strunk@example.org
607ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
608ATTENDEE;SCHEDULE-FORCE-SEND=REQUEST;CN=One:mailto:one@example.org
609DTSTART:20140716T120000Z
610DTEND:20140716T130000Z
611END:VEVENT
612END:VCALENDAR
613ICS;
614
615        $version = \Sabre\VObject\Version::VERSION;
616
617        $expected = array(
618            array(
619                'uid' => 'foobar',
620                'method' => 'REQUEST',
621                'component' => 'VEVENT',
622                'sender' => 'mailto:strunk@example.org',
623                'senderName' => 'Strunk',
624                'recipient' => 'mailto:one@example.org',
625                'recipientName' => 'One',
626                'significantChange' => true,
627                'message' => <<<ICS
628BEGIN:VCALENDAR
629VERSION:2.0
630PRODID:-//Sabre//Sabre VObject $version//EN
631CALSCALE:GREGORIAN
632METHOD:REQUEST
633BEGIN:VEVENT
634UID:foobar
635SEQUENCE:2
636ORGANIZER;CN=Strunk:mailto:strunk@example.org
637ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
638ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
639DTSTART:20140716T120000Z
640DTEND:20140716T130000Z
641END:VEVENT
642END:VCALENDAR
643ICS
644
645            ),
646
647        );
648
649        $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
650
651    }
652
653    function testInviteRemoveAttendees() {
654
655        $oldMessage = <<<ICS
656BEGIN:VCALENDAR
657VERSION:2.0
658BEGIN:VEVENT
659UID:foobar
660SEQUENCE:1
661SUMMARY:foo
662ORGANIZER;CN=Strunk:mailto:strunk@example.org
663ATTENDEE;CN=Strunk:mailto:strunk@example.org
664ATTENDEE;CN=One:mailto:one@example.org
665ATTENDEE;CN=Two:mailto:two@example.org
666DTSTART:20140716T120000Z
667DTEND:20140716T130000Z
668END:VEVENT
669END:VCALENDAR
670ICS;
671
672
673        $newMessage = <<<ICS
674BEGIN:VCALENDAR
675VERSION:2.0
676BEGIN:VEVENT
677UID:foobar
678SEQUENCE:2
679SUMMARY:foo
680DTSTART:20140716T120000Z
681DTEND:20140716T130000Z
682END:VEVENT
683END:VCALENDAR
684ICS;
685
686        $version = \Sabre\VObject\Version::VERSION;
687
688        $expected = array(
689            array(
690                'uid' => 'foobar',
691                'method' => 'CANCEL',
692                'component' => 'VEVENT',
693                'sender' => 'mailto:strunk@example.org',
694                'senderName' => 'Strunk',
695                'recipient' => 'mailto:one@example.org',
696                'recipientName' => 'One',
697                'significantChange' => true,
698                'message' => <<<ICS
699BEGIN:VCALENDAR
700VERSION:2.0
701PRODID:-//Sabre//Sabre VObject $version//EN
702CALSCALE:GREGORIAN
703METHOD:CANCEL
704BEGIN:VEVENT
705UID:foobar
706SEQUENCE:2
707SUMMARY:foo
708DTSTART:20140716T120000Z
709DTEND:20140716T130000Z
710ORGANIZER;CN=Strunk:mailto:strunk@example.org
711ATTENDEE;CN=One:mailto:one@example.org
712END:VEVENT
713END:VCALENDAR
714ICS
715
716            ),
717            array(
718                'uid' => 'foobar',
719                'method' => 'CANCEL',
720                'component' => 'VEVENT',
721                'sender' => 'mailto:strunk@example.org',
722                'senderName' => 'Strunk',
723                'recipient' => 'mailto:two@example.org',
724                'recipientName' => 'Two',
725                'significantChange' => true,
726                'message' => <<<ICS
727BEGIN:VCALENDAR
728VERSION:2.0
729PRODID:-//Sabre//Sabre VObject $version//EN
730CALSCALE:GREGORIAN
731METHOD:CANCEL
732BEGIN:VEVENT
733UID:foobar
734SEQUENCE:2
735SUMMARY:foo
736DTSTART:20140716T120000Z
737DTEND:20140716T130000Z
738ORGANIZER;CN=Strunk:mailto:strunk@example.org
739ATTENDEE;CN=Two:mailto:two@example.org
740END:VEVENT
741END:VCALENDAR
742ICS
743
744            ),
745        );
746
747        $result = $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
748
749    }
750
751    function testInviteChangeExdateOrder() {
752
753        $oldMessage = <<<ICS
754BEGIN:VCALENDAR
755VERSION:2.0
756PRODID:-//Apple Inc.//Mac OS X 10.10.1//EN
757CALSCALE:GREGORIAN
758BEGIN:VEVENT
759UID:foobar
760SEQUENCE:0
761ORGANIZER;CN=Strunk:mailto:strunk@example.org
762ATTENDEE;CN=Strunk;CUTYPE=INDIVIDUAL;EMAIL=strunk@example.org;PARTSTAT=ACCE
763 PTED:mailto:strunk@example.org
764ATTENDEE;CN=One;CUTYPE=INDIVIDUAL;EMAIL=one@example.org;PARTSTAT=ACCEPTED;R
765 OLE=REQ-PARTICIPANT;SCHEDULE-STATUS="1.2;Message delivered locally":mailto
766 :one@example.org
767SUMMARY:foo
768DTSTART:20141211T160000Z
769DTEND:20141211T170000Z
770RRULE:FREQ=WEEKLY
771EXDATE:20141225T160000Z,20150101T160000Z
772EXDATE:20150108T160000Z
773END:VEVENT
774END:VCALENDAR
775ICS;
776
777
778        $newMessage = <<<ICS
779BEGIN:VCALENDAR
780VERSION:2.0
781PRODID:-//Apple Inc.//Mac OS X 10.10.1//EN
782CALSCALE:GREGORIAN
783BEGIN:VEVENT
784UID:foobar
785SEQUENCE:1
786ORGANIZER;CN=Strunk:mailto:strunk@example.org
787ATTENDEE;CN=Strunk;CUTYPE=INDIVIDUAL;EMAIL=strunk@example.org;PARTSTAT=ACCE
788 PTED:mailto:strunk@example.org
789ATTENDEE;CN=One;CUTYPE=INDIVIDUAL;EMAIL=one@example.org;PARTSTAT=ACCEPTED;R
790 OLE=REQ-PARTICIPANT;SCHEDULE-STATUS=1.2:mailto:one@example.org
791DTSTART:20141211T160000Z
792DTEND:20141211T170000Z
793RRULE:FREQ=WEEKLY
794EXDATE:20150101T160000Z
795EXDATE:20150108T160000Z,20141225T160000Z
796END:VEVENT
797END:VCALENDAR
798ICS;
799
800        $version = \Sabre\VObject\Version::VERSION;
801
802        $expected = array(
803            array(
804                'uid' => 'foobar',
805                'method' => 'REQUEST',
806                'component' => 'VEVENT',
807                'sender' => 'mailto:strunk@example.org',
808                'senderName' => 'Strunk',
809                'recipient' => 'mailto:one@example.org',
810                'recipientName' => 'One',
811                'significantChange' => false,
812                'message' => <<<ICS
813BEGIN:VCALENDAR
814VERSION:2.0
815PRODID:-//Sabre//Sabre VObject $version//EN
816CALSCALE:GREGORIAN
817METHOD:REQUEST
818BEGIN:VEVENT
819UID:foobar
820SEQUENCE:1
821ORGANIZER;CN=Strunk:mailto:strunk@example.org
822ATTENDEE;CN=Strunk;CUTYPE=INDIVIDUAL;EMAIL=strunk@example.org;PARTSTAT=ACCE
823 PTED:mailto:strunk@example.org
824ATTENDEE;CN=One;CUTYPE=INDIVIDUAL;EMAIL=one@example.org;PARTSTAT=ACCEPTED;R
825 OLE=REQ-PARTICIPANT:mailto:one@example.org
826DTSTART:20141211T160000Z
827DTEND:20141211T170000Z
828RRULE:FREQ=WEEKLY
829EXDATE:20150101T160000Z
830EXDATE:20150108T160000Z,20141225T160000Z
831END:VEVENT
832END:VCALENDAR
833ICS
834
835            ),
836        );
837
838        $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
839
840    }
841}
842