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