7
|
1 <?php
|
|
2
|
|
3 namespace Sabre\VObject\ITip;
|
|
4
|
|
5 class BrokerUpdateTest extends BrokerTester {
|
|
6
|
|
7 function testInviteChange() {
|
|
8
|
|
9 $oldMessage = <<<ICS
|
|
10 BEGIN:VCALENDAR
|
|
11 VERSION:2.0
|
|
12 BEGIN:VEVENT
|
|
13 UID:foobar
|
|
14 SEQUENCE:1
|
|
15 SUMMARY:foo
|
|
16 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
17 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
18 ATTENDEE;CN=One:mailto:one@example.org
|
|
19 ATTENDEE;CN=Two:mailto:two@example.org
|
|
20 DTSTART:20140716T120000Z
|
|
21 END:VEVENT
|
|
22 END:VCALENDAR
|
|
23 ICS;
|
|
24
|
|
25
|
|
26 $newMessage = <<<ICS
|
|
27 BEGIN:VCALENDAR
|
|
28 VERSION:2.0
|
|
29 BEGIN:VEVENT
|
|
30 UID:foobar
|
|
31 SEQUENCE:2
|
|
32 SUMMARY:foo
|
|
33 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
34 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
35 ATTENDEE;CN=Two:mailto:two@example.org
|
|
36 ATTENDEE;CN=Three:mailto:three@example.org
|
|
37 DTSTART:20140716T120000Z
|
|
38 END:VEVENT
|
|
39 END:VCALENDAR
|
|
40 ICS;
|
|
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
|
|
55 BEGIN:VCALENDAR
|
|
56 VERSION:2.0
|
|
57 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
58 CALSCALE:GREGORIAN
|
|
59 METHOD:CANCEL
|
|
60 BEGIN:VEVENT
|
|
61 UID:foobar
|
|
62 SEQUENCE:2
|
|
63 SUMMARY:foo
|
|
64 DTSTART:20140716T120000Z
|
|
65 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
66 ATTENDEE;CN=One:mailto:one@example.org
|
|
67 END:VEVENT
|
|
68 END:VCALENDAR
|
|
69 ICS
|
|
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
|
|
82 BEGIN:VCALENDAR
|
|
83 VERSION:2.0
|
|
84 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
85 CALSCALE:GREGORIAN
|
|
86 METHOD:REQUEST
|
|
87 BEGIN:VEVENT
|
|
88 UID:foobar
|
|
89 SEQUENCE:2
|
|
90 SUMMARY:foo
|
|
91 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
92 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
93 ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
|
|
94 ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
|
|
95 DTSTART:20140716T120000Z
|
|
96 END:VEVENT
|
|
97 END:VCALENDAR
|
|
98 ICS
|
|
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
|
|
111 BEGIN:VCALENDAR
|
|
112 VERSION:2.0
|
|
113 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
114 CALSCALE:GREGORIAN
|
|
115 METHOD:REQUEST
|
|
116 BEGIN:VEVENT
|
|
117 UID:foobar
|
|
118 SEQUENCE:2
|
|
119 SUMMARY:foo
|
|
120 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
121 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
122 ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
|
|
123 ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
|
|
124 DTSTART:20140716T120000Z
|
|
125 END:VEVENT
|
|
126 END:VCALENDAR
|
|
127 ICS
|
|
128
|
|
129 ),
|
|
130 );
|
|
131
|
|
132 $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
|
|
133
|
|
134 }
|
|
135
|
|
136 function testInviteChangeFromNonSchedulingToSchedulingObject() {
|
|
137
|
|
138 $oldMessage = <<<ICS
|
|
139 BEGIN:VCALENDAR
|
|
140 VERSION:2.0
|
|
141 BEGIN:VEVENT
|
|
142 UID:foobar
|
|
143 SEQUENCE:1
|
|
144 DTSTART:20140716T120000Z
|
|
145 END:VEVENT
|
|
146 END:VCALENDAR
|
|
147 ICS;
|
|
148
|
|
149
|
|
150 $newMessage = <<<ICS
|
|
151 BEGIN:VCALENDAR
|
|
152 VERSION:2.0
|
|
153 BEGIN:VEVENT
|
|
154 UID:foobar
|
|
155 SEQUENCE:2
|
|
156 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
157 ATTENDEE;CN=One:mailto:one@example.org
|
|
158 DTSTART:20140716T120000Z
|
|
159 END:VEVENT
|
|
160 END:VCALENDAR
|
|
161 ICS;
|
|
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
|
|
175 BEGIN:VCALENDAR
|
|
176 VERSION:2.0
|
|
177 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
178 CALSCALE:GREGORIAN
|
|
179 METHOD:REQUEST
|
|
180 BEGIN:VEVENT
|
|
181 UID:foobar
|
|
182 SEQUENCE:2
|
|
183 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
184 ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
|
|
185 DTSTART:20140716T120000Z
|
|
186 END:VEVENT
|
|
187 END:VCALENDAR
|
|
188 ICS
|
|
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
|
|
201 BEGIN:VCALENDAR
|
|
202 VERSION:2.0
|
|
203 BEGIN:VEVENT
|
|
204 UID:foobar
|
|
205 SEQUENCE:2
|
|
206 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
207 ATTENDEE;CN=One:mailto:one@example.org
|
|
208 DTSTART:20140716T120000Z
|
|
209 END:VEVENT
|
|
210 END:VCALENDAR
|
|
211 ICS;
|
|
212
|
|
213
|
|
214 $newMessage = <<<ICS
|
|
215 BEGIN:VCALENDAR
|
|
216 VERSION:2.0
|
|
217 BEGIN:VEVENT
|
|
218 UID:foobar
|
|
219 SEQUENCE:1
|
|
220 DTSTART:20140716T120000Z
|
|
221 END:VEVENT
|
|
222 END:VCALENDAR
|
|
223 ICS;
|
|
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
|
|
233 BEGIN:VCALENDAR
|
|
234 VERSION:2.0
|
|
235 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
236 CALSCALE:GREGORIAN
|
|
237 METHOD:CANCEL
|
|
238 BEGIN:VEVENT
|
|
239 UID:foobar
|
|
240 SEQUENCE:1
|
|
241 DTSTART:20140716T120000Z
|
|
242 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
243 ATTENDEE;CN=One:mailto:one@example.org
|
|
244 END:VEVENT
|
|
245 END:VCALENDAR
|
|
246 ICS
|
|
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
|
|
259 BEGIN:VCALENDAR
|
|
260 VERSION:2.0
|
|
261 BEGIN:VEVENT
|
|
262 UID:foobar
|
|
263 SEQUENCE:1
|
|
264 DTSTART:20140716T120000Z
|
|
265 END:VEVENT
|
|
266 END:VCALENDAR
|
|
267 ICS;
|
|
268
|
|
269
|
|
270 $newMessage = <<<ICS
|
|
271 BEGIN:VCALENDAR
|
|
272 VERSION:2.0
|
|
273 BEGIN:VEVENT
|
|
274 UID:foobar
|
|
275 SEQUENCE:2
|
|
276 DTSTART:20140716T120000Z
|
|
277 END:VEVENT
|
|
278 END:VCALENDAR
|
|
279 ICS;
|
|
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
|
|
291 BEGIN:VCALENDAR
|
|
292 VERSION:2.0
|
|
293 BEGIN:VEVENT
|
|
294 UID:foobar
|
|
295 SEQUENCE:1
|
|
296 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
297 ATTENDEE;CN=One:mailto:one@example.org
|
|
298 DTSTART;TZID=America/Toronto:20140716T120000
|
|
299 RRULE:FREQ=WEEKLY
|
|
300 END:VEVENT
|
|
301 END:VCALENDAR
|
|
302 ICS;
|
|
303
|
|
304
|
|
305 $newMessage = <<<ICS
|
|
306 BEGIN:VCALENDAR
|
|
307 VERSION:2.0
|
|
308 BEGIN:VEVENT
|
|
309 UID:foobar
|
|
310 SEQUENCE:2
|
|
311 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
312 ATTENDEE;CN=One:mailto:one@example.org
|
|
313 DTSTART;TZID=America/Toronto:20140716T120000
|
|
314 RRULE:FREQ=WEEKLY
|
|
315 EXDATE;TZID=America/Toronto:20140724T120000
|
|
316 END:VEVENT
|
|
317 END:VCALENDAR
|
|
318 ICS;
|
|
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
|
|
332 BEGIN:VCALENDAR
|
|
333 VERSION:2.0
|
|
334 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
335 CALSCALE:GREGORIAN
|
|
336 METHOD:REQUEST
|
|
337 BEGIN:VEVENT
|
|
338 UID:foobar
|
|
339 SEQUENCE:2
|
|
340 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
341 ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
|
|
342 DTSTART;TZID=America/Toronto:20140716T120000
|
|
343 RRULE:FREQ=WEEKLY
|
|
344 EXDATE;TZID=America/Toronto:20140724T120000
|
|
345 END:VEVENT
|
|
346 END:VCALENDAR
|
|
347 ICS
|
|
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
|
|
365 BEGIN:VCALENDAR
|
|
366 VERSION:2.0
|
|
367 BEGIN:VEVENT
|
|
368 UID:foobar
|
|
369 DURATION:PT1H
|
|
370 SEQUENCE:1
|
|
371 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
372 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
373 ATTENDEE;CN=One:mailto:one@example.org
|
|
374 ATTENDEE;CN=Two:mailto:two@example.org
|
|
375 DTSTART:20140716T120000Z
|
|
376 END:VEVENT
|
|
377 END:VCALENDAR
|
|
378 ICS;
|
|
379
|
|
380
|
|
381 $newMessage = <<<ICS
|
|
382 BEGIN:VCALENDAR
|
|
383 VERSION:2.0
|
|
384 BEGIN:VEVENT
|
|
385 UID:foobar
|
|
386 DURATION:PT2H
|
|
387 SEQUENCE:2
|
|
388 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
389 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
390 ATTENDEE;CN=Two:mailto:two@example.org
|
|
391 ATTENDEE;CN=Three:mailto:three@example.org
|
|
392 DTSTART:20140716T120000Z
|
|
393 END:VEVENT
|
|
394 END:VCALENDAR
|
|
395 ICS;
|
|
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
|
|
410 BEGIN:VCALENDAR
|
|
411 VERSION:2.0
|
|
412 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
413 CALSCALE:GREGORIAN
|
|
414 METHOD:CANCEL
|
|
415 BEGIN:VEVENT
|
|
416 UID:foobar
|
|
417 SEQUENCE:2
|
|
418 DTSTART:20140716T120000Z
|
|
419 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
420 ATTENDEE;CN=One:mailto:one@example.org
|
|
421 END:VEVENT
|
|
422 END:VCALENDAR
|
|
423 ICS
|
|
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
|
|
436 BEGIN:VCALENDAR
|
|
437 VERSION:2.0
|
|
438 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
439 CALSCALE:GREGORIAN
|
|
440 METHOD:REQUEST
|
|
441 BEGIN:VEVENT
|
|
442 UID:foobar
|
|
443 DURATION:PT2H
|
|
444 SEQUENCE:2
|
|
445 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
446 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
447 ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
|
|
448 ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
|
|
449 DTSTART:20140716T120000Z
|
|
450 END:VEVENT
|
|
451 END:VCALENDAR
|
|
452 ICS
|
|
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
|
|
465 BEGIN:VCALENDAR
|
|
466 VERSION:2.0
|
|
467 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
468 CALSCALE:GREGORIAN
|
|
469 METHOD:REQUEST
|
|
470 BEGIN:VEVENT
|
|
471 UID:foobar
|
|
472 DURATION:PT2H
|
|
473 SEQUENCE:2
|
|
474 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
475 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
476 ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
|
|
477 ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
|
|
478 DTSTART:20140716T120000Z
|
|
479 END:VEVENT
|
|
480 END:VCALENDAR
|
|
481 ICS
|
|
482
|
|
483 ),
|
|
484 );
|
|
485
|
|
486 $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
|
|
487
|
|
488 }
|
|
489
|
|
490 function testInviteNoChange() {
|
|
491
|
|
492 $oldMessage = <<<ICS
|
|
493 BEGIN:VCALENDAR
|
|
494 VERSION:2.0
|
|
495 BEGIN:VEVENT
|
|
496 UID:foobar
|
|
497 SEQUENCE:1
|
|
498 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
499 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
500 ATTENDEE;CN=One:mailto:one@example.org
|
|
501 DTSTART:20140716T120000Z
|
|
502 END:VEVENT
|
|
503 END:VCALENDAR
|
|
504 ICS;
|
|
505
|
|
506
|
|
507 $newMessage = <<<ICS
|
|
508 BEGIN:VCALENDAR
|
|
509 VERSION:2.0
|
|
510 BEGIN:VEVENT
|
|
511 UID:foobar
|
|
512 SEQUENCE:2
|
|
513 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
514 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
515 ATTENDEE;CN=One:mailto:one@example.org
|
|
516 DTSTART:20140716T120000Z
|
|
517 END:VEVENT
|
|
518 END:VCALENDAR
|
|
519 ICS;
|
|
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
|
|
534 BEGIN:VCALENDAR
|
|
535 VERSION:2.0
|
|
536 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
537 CALSCALE:GREGORIAN
|
|
538 METHOD:REQUEST
|
|
539 BEGIN:VEVENT
|
|
540 UID:foobar
|
|
541 SEQUENCE:2
|
|
542 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
543 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
544 ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
|
|
545 DTSTART:20140716T120000Z
|
|
546 END:VEVENT
|
|
547 END:VCALENDAR
|
|
548 ICS
|
|
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
|
|
561 BEGIN:VCALENDAR
|
|
562 VERSION:2.0
|
|
563 BEGIN:VEVENT
|
|
564 UID:foobar
|
|
565 SEQUENCE:1
|
|
566 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
567 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
568 ATTENDEE;CN=One:mailto:one@example.org
|
|
569 DTSTART:20140716T120000Z
|
|
570 END:VEVENT
|
|
571 END:VCALENDAR
|
|
572 ICS;
|
|
573
|
|
574
|
|
575 $newMessage = <<<ICS
|
|
576 BEGIN:VCALENDAR
|
|
577 VERSION:2.0
|
|
578 BEGIN:VEVENT
|
|
579 UID:foobar
|
|
580 SEQUENCE:2
|
|
581 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
582 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
583 ATTENDEE;SCHEDULE-FORCE-SEND=REQUEST;CN=One:mailto:one@example.org
|
|
584 DTSTART:20140716T120000Z
|
|
585 END:VEVENT
|
|
586 END:VCALENDAR
|
|
587 ICS;
|
|
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
|
|
602 BEGIN:VCALENDAR
|
|
603 VERSION:2.0
|
|
604 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
605 CALSCALE:GREGORIAN
|
|
606 METHOD:REQUEST
|
|
607 BEGIN:VEVENT
|
|
608 UID:foobar
|
|
609 SEQUENCE:2
|
|
610 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
611 ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
|
|
612 ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
|
|
613 DTSTART:20140716T120000Z
|
|
614 END:VEVENT
|
|
615 END:VCALENDAR
|
|
616 ICS
|
|
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
|
|
629 BEGIN:VCALENDAR
|
|
630 VERSION:2.0
|
|
631 BEGIN:VEVENT
|
|
632 UID:foobar
|
|
633 SEQUENCE:1
|
|
634 SUMMARY:foo
|
|
635 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
636 ATTENDEE;CN=Strunk:mailto:strunk@example.org
|
|
637 ATTENDEE;CN=One:mailto:one@example.org
|
|
638 ATTENDEE;CN=Two:mailto:two@example.org
|
|
639 DTSTART:20140716T120000Z
|
|
640 END:VEVENT
|
|
641 END:VCALENDAR
|
|
642 ICS;
|
|
643
|
|
644
|
|
645 $newMessage = <<<ICS
|
|
646 BEGIN:VCALENDAR
|
|
647 VERSION:2.0
|
|
648 BEGIN:VEVENT
|
|
649 UID:foobar
|
|
650 SEQUENCE:2
|
|
651 SUMMARY:foo
|
|
652 DTSTART:20140716T120000Z
|
|
653 END:VEVENT
|
|
654 END:VCALENDAR
|
|
655 ICS;
|
|
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
|
|
670 BEGIN:VCALENDAR
|
|
671 VERSION:2.0
|
|
672 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
673 CALSCALE:GREGORIAN
|
|
674 METHOD:CANCEL
|
|
675 BEGIN:VEVENT
|
|
676 UID:foobar
|
|
677 SEQUENCE:2
|
|
678 SUMMARY:foo
|
|
679 DTSTART:20140716T120000Z
|
|
680 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
681 ATTENDEE;CN=One:mailto:one@example.org
|
|
682 END:VEVENT
|
|
683 END:VCALENDAR
|
|
684 ICS
|
|
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
|
|
697 BEGIN:VCALENDAR
|
|
698 VERSION:2.0
|
|
699 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
700 CALSCALE:GREGORIAN
|
|
701 METHOD:CANCEL
|
|
702 BEGIN:VEVENT
|
|
703 UID:foobar
|
|
704 SEQUENCE:2
|
|
705 SUMMARY:foo
|
|
706 DTSTART:20140716T120000Z
|
|
707 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
708 ATTENDEE;CN=Two:mailto:two@example.org
|
|
709 END:VEVENT
|
|
710 END:VCALENDAR
|
|
711 ICS
|
|
712
|
|
713 ),
|
|
714 );
|
|
715
|
|
716 $result = $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
|
|
717
|
|
718 }
|
|
719 }
|