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