7
|
1 <?php
|
|
2
|
|
3 namespace Sabre\VObject\ITip;
|
|
4
|
|
5 class BrokerAttendeeReplyTest extends BrokerTester {
|
|
6
|
|
7 function testAccepted() {
|
|
8
|
|
9 $oldMessage = <<<ICS
|
|
10 BEGIN:VCALENDAR
|
|
11 VERSION:2.0
|
|
12 BEGIN:VEVENT
|
|
13 UID:foobar
|
|
14 SUMMARY:B-day party
|
|
15 SEQUENCE:1
|
|
16 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
17 ATTENDEE;CN=One:mailto:one@example.org
|
|
18 DTSTART:20140716T120000Z
|
|
19 END:VEVENT
|
|
20 END:VCALENDAR
|
|
21 ICS;
|
|
22
|
|
23
|
|
24 $newMessage = <<<ICS
|
|
25 BEGIN:VCALENDAR
|
|
26 VERSION:2.0
|
|
27 BEGIN:VEVENT
|
|
28 UID:foobar
|
|
29 SUMMARY:B-day party
|
|
30 SEQUENCE:1
|
|
31 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
32 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
33 DTSTART:20140716T120000Z
|
|
34 END:VEVENT
|
|
35 END:VCALENDAR
|
|
36 ICS;
|
|
37
|
|
38 $version = \Sabre\VObject\Version::VERSION;
|
|
39
|
|
40 $expected = array(
|
|
41 array(
|
|
42 'uid' => 'foobar',
|
|
43 'method' => 'REPLY',
|
|
44 'component' => 'VEVENT',
|
|
45 'sender' => 'mailto:one@example.org',
|
|
46 'senderName' => 'One',
|
|
47 'recipient' => 'mailto:strunk@example.org',
|
|
48 'recipientName' => 'Strunk',
|
|
49 'message' => <<<ICS
|
|
50 BEGIN:VCALENDAR
|
|
51 VERSION:2.0
|
|
52 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
53 CALSCALE:GREGORIAN
|
|
54 METHOD:REPLY
|
|
55 BEGIN:VEVENT
|
|
56 UID:foobar
|
|
57 SEQUENCE:1
|
|
58 DTSTART:20140716T120000Z
|
|
59 SUMMARY:B-day party
|
|
60 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
61 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
62 END:VEVENT
|
|
63 END:VCALENDAR
|
|
64 ICS
|
|
65
|
|
66 ),
|
|
67
|
|
68 );
|
|
69
|
|
70 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
71
|
|
72 }
|
|
73
|
|
74 function testRecurringReply() {
|
|
75
|
|
76 $oldMessage = <<<ICS
|
|
77 BEGIN:VCALENDAR
|
|
78 VERSION:2.0
|
|
79 BEGIN:VEVENT
|
|
80 UID:foobar
|
|
81 SEQUENCE:1
|
|
82 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
83 ATTENDEE;CN=One:mailto:one@example.org
|
|
84 DTSTART:20140724T120000Z
|
|
85 SUMMARY:Daily sprint
|
|
86 RRULE;FREQ=DAILY
|
|
87 END:VEVENT
|
|
88 END:VCALENDAR
|
|
89 ICS;
|
|
90
|
|
91
|
|
92 $newMessage = <<<ICS
|
|
93 BEGIN:VCALENDAR
|
|
94 VERSION:2.0
|
|
95 BEGIN:VEVENT
|
|
96 UID:foobar
|
|
97 SEQUENCE:1
|
|
98 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
99 ATTENDEE;PARTSTAT=NEEDS-ACTION;CN=One:mailto:one@example.org
|
|
100 DTSTART:20140724T120000Z
|
|
101 SUMMARY:Daily sprint
|
|
102 END:VEVENT
|
|
103 BEGIN:VEVENT
|
|
104 UID:foobar
|
|
105 SEQUENCE:1
|
|
106 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
107 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
108 DTSTART:20140726T120000Z
|
|
109 RECURRENCE-ID:20140726T120000Z
|
|
110 END:VEVENT
|
|
111 BEGIN:VEVENT
|
|
112 UID:foobar
|
|
113 SEQUENCE:1
|
|
114 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
115 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
116 DTSTART:20140724T120000Z
|
|
117 RECURRENCE-ID:20140724T120000Z
|
|
118 END:VEVENT
|
|
119 BEGIN:VEVENT
|
|
120 UID:foobar
|
|
121 SEQUENCE:1
|
|
122 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
123 ATTENDEE;PARTSTAT=TENTATIVE;CN=One:mailto:one@example.org
|
|
124 DTSTART:20140728T120000Z
|
|
125 RECURRENCE-ID:20140728T120000Z
|
|
126 END:VEVENT
|
|
127 BEGIN:VEVENT
|
|
128 UID:foobar
|
|
129 SEQUENCE:1
|
|
130 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
131 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
132 DTSTART:20140729T120000Z
|
|
133 RECURRENCE-ID:20140729T120000Z
|
|
134 END:VEVENT
|
|
135 BEGIN:VEVENT
|
|
136 UID:foobar
|
|
137 SEQUENCE:1
|
|
138 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
139 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
140 DTSTART:20140725T120000Z
|
|
141 RECURRENCE-ID:20140725T120000Z
|
|
142 END:VEVENT
|
|
143 END:VCALENDAR
|
|
144 ICS;
|
|
145
|
|
146 $version = \Sabre\VObject\Version::VERSION;
|
|
147
|
|
148 $expected = array(
|
|
149 array(
|
|
150 'uid' => 'foobar',
|
|
151 'method' => 'REPLY',
|
|
152 'component' => 'VEVENT',
|
|
153 'sender' => 'mailto:one@example.org',
|
|
154 'senderName' => 'One',
|
|
155 'recipient' => 'mailto:strunk@example.org',
|
|
156 'recipientName' => 'Strunk',
|
|
157 'message' => <<<ICS
|
|
158 BEGIN:VCALENDAR
|
|
159 VERSION:2.0
|
|
160 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
161 CALSCALE:GREGORIAN
|
|
162 METHOD:REPLY
|
|
163 BEGIN:VEVENT
|
|
164 UID:foobar
|
|
165 SEQUENCE:1
|
|
166 DTSTART:20140726T120000Z
|
|
167 SUMMARY:Daily sprint
|
|
168 RECURRENCE-ID:20140726T120000Z
|
|
169 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
170 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
171 END:VEVENT
|
|
172 BEGIN:VEVENT
|
|
173 UID:foobar
|
|
174 SEQUENCE:1
|
|
175 DTSTART:20140724T120000Z
|
|
176 SUMMARY:Daily sprint
|
|
177 RECURRENCE-ID:20140724T120000Z
|
|
178 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
179 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
180 END:VEVENT
|
|
181 BEGIN:VEVENT
|
|
182 UID:foobar
|
|
183 SEQUENCE:1
|
|
184 DTSTART:20140728T120000Z
|
|
185 SUMMARY:Daily sprint
|
|
186 RECURRENCE-ID:20140728T120000Z
|
|
187 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
188 ATTENDEE;PARTSTAT=TENTATIVE;CN=One:mailto:one@example.org
|
|
189 END:VEVENT
|
|
190 BEGIN:VEVENT
|
|
191 UID:foobar
|
|
192 SEQUENCE:1
|
|
193 DTSTART:20140729T120000Z
|
|
194 SUMMARY:Daily sprint
|
|
195 RECURRENCE-ID:20140729T120000Z
|
|
196 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
197 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
198 END:VEVENT
|
|
199 BEGIN:VEVENT
|
|
200 UID:foobar
|
|
201 SEQUENCE:1
|
|
202 DTSTART:20140725T120000Z
|
|
203 SUMMARY:Daily sprint
|
|
204 RECURRENCE-ID:20140725T120000Z
|
|
205 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
206 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
207 END:VEVENT
|
|
208 END:VCALENDAR
|
|
209 ICS
|
|
210
|
|
211 ),
|
|
212
|
|
213 );
|
|
214
|
|
215 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
216
|
|
217 }
|
|
218
|
|
219 function testRecurringAllDay() {
|
|
220
|
|
221 $oldMessage = <<<ICS
|
|
222 BEGIN:VCALENDAR
|
|
223 VERSION:2.0
|
|
224 BEGIN:VEVENT
|
|
225 UID:foobar
|
|
226 SEQUENCE:1
|
|
227 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
228 ATTENDEE;CN=One:mailto:one@example.org
|
|
229 DTSTART;VALUE=DATE:20140724
|
|
230 RRULE;FREQ=DAILY
|
|
231 END:VEVENT
|
|
232 END:VCALENDAR
|
|
233 ICS;
|
|
234
|
|
235
|
|
236 $newMessage = <<<ICS
|
|
237 BEGIN:VCALENDAR
|
|
238 VERSION:2.0
|
|
239 BEGIN:VEVENT
|
|
240 UID:foobar
|
|
241 SEQUENCE:1
|
|
242 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
243 ATTENDEE;PARTSTAT=NEEDS-ACTION;CN=One:mailto:one@example.org
|
|
244 DTSTART;VALUE=DATE:20140724
|
|
245 END:VEVENT
|
|
246 BEGIN:VEVENT
|
|
247 UID:foobar
|
|
248 SEQUENCE:1
|
|
249 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
250 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
251 DTSTART;VALUE=DATE:20140726
|
|
252 RECURRENCE-ID;VALUE=DATE:20140726
|
|
253 END:VEVENT
|
|
254 BEGIN:VEVENT
|
|
255 UID:foobar
|
|
256 SEQUENCE:1
|
|
257 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
258 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
259 DTSTART;VALUE=DATE:20140724
|
|
260 RECURRENCE-ID;VALUE=DATE:20140724
|
|
261 END:VEVENT
|
|
262 BEGIN:VEVENT
|
|
263 UID:foobar
|
|
264 SEQUENCE:1
|
|
265 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
266 ATTENDEE;PARTSTAT=TENTATIVE;CN=One:mailto:one@example.org
|
|
267 DTSTART;VALUE=DATE:20140728
|
|
268 RECURRENCE-ID;VALUE=DATE:20140728
|
|
269 END:VEVENT
|
|
270 BEGIN:VEVENT
|
|
271 UID:foobar
|
|
272 SEQUENCE:1
|
|
273 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
274 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
275 DTSTART;VALUE=DATE:20140729
|
|
276 RECURRENCE-ID;VALUE=DATE:20140729
|
|
277 END:VEVENT
|
|
278 BEGIN:VEVENT
|
|
279 UID:foobar
|
|
280 SEQUENCE:1
|
|
281 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
282 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
283 DTSTART;VALUE=DATE:20140725
|
|
284 RECURRENCE-ID;VALUE=DATE:20140725
|
|
285 END:VEVENT
|
|
286 END:VCALENDAR
|
|
287 ICS;
|
|
288
|
|
289 $version = \Sabre\VObject\Version::VERSION;
|
|
290
|
|
291 $expected = array(
|
|
292 array(
|
|
293 'uid' => 'foobar',
|
|
294 'method' => 'REPLY',
|
|
295 'component' => 'VEVENT',
|
|
296 'sender' => 'mailto:one@example.org',
|
|
297 'senderName' => 'One',
|
|
298 'recipient' => 'mailto:strunk@example.org',
|
|
299 'recipientName' => 'Strunk',
|
|
300 'message' => <<<ICS
|
|
301 BEGIN:VCALENDAR
|
|
302 VERSION:2.0
|
|
303 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
304 CALSCALE:GREGORIAN
|
|
305 METHOD:REPLY
|
|
306 BEGIN:VEVENT
|
|
307 UID:foobar
|
|
308 SEQUENCE:1
|
|
309 DTSTART;VALUE=DATE:20140726
|
|
310 RECURRENCE-ID;VALUE=DATE:20140726
|
|
311 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
312 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
313 END:VEVENT
|
|
314 BEGIN:VEVENT
|
|
315 UID:foobar
|
|
316 SEQUENCE:1
|
|
317 DTSTART;VALUE=DATE:20140724
|
|
318 RECURRENCE-ID;VALUE=DATE:20140724
|
|
319 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
320 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
321 END:VEVENT
|
|
322 BEGIN:VEVENT
|
|
323 UID:foobar
|
|
324 SEQUENCE:1
|
|
325 DTSTART;VALUE=DATE:20140728
|
|
326 RECURRENCE-ID;VALUE=DATE:20140728
|
|
327 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
328 ATTENDEE;PARTSTAT=TENTATIVE;CN=One:mailto:one@example.org
|
|
329 END:VEVENT
|
|
330 BEGIN:VEVENT
|
|
331 UID:foobar
|
|
332 SEQUENCE:1
|
|
333 DTSTART;VALUE=DATE:20140729
|
|
334 RECURRENCE-ID;VALUE=DATE:20140729
|
|
335 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
336 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
337 END:VEVENT
|
|
338 BEGIN:VEVENT
|
|
339 UID:foobar
|
|
340 SEQUENCE:1
|
|
341 DTSTART;VALUE=DATE:20140725
|
|
342 RECURRENCE-ID;VALUE=DATE:20140725
|
|
343 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
344 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
345 END:VEVENT
|
|
346 END:VCALENDAR
|
|
347 ICS
|
|
348
|
|
349 ),
|
|
350
|
|
351 );
|
|
352
|
|
353 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
354
|
|
355 }
|
|
356
|
|
357 function testNoChange() {
|
|
358
|
|
359 $oldMessage = <<<ICS
|
|
360 BEGIN:VCALENDAR
|
|
361 VERSION:2.0
|
|
362 BEGIN:VEVENT
|
|
363 UID:foobar
|
|
364 SEQUENCE:1
|
|
365 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
366 ATTENDEE;CN=One:mailto:one@example.org
|
|
367 DTSTART:20140716T120000Z
|
|
368 END:VEVENT
|
|
369 END:VCALENDAR
|
|
370 ICS;
|
|
371
|
|
372
|
|
373 $newMessage = <<<ICS
|
|
374 BEGIN:VCALENDAR
|
|
375 VERSION:2.0
|
|
376 BEGIN:VEVENT
|
|
377 UID:foobar
|
|
378 SEQUENCE:1
|
|
379 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
380 ATTENDEE;PARTSTAT=NEEDS-ACTION;CN=One:mailto:one@example.org
|
|
381 DTSTART:20140716T120000Z
|
|
382 END:VEVENT
|
|
383 END:VCALENDAR
|
|
384 ICS;
|
|
385
|
|
386
|
|
387 $expected = array();
|
|
388 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
389
|
|
390 }
|
|
391
|
|
392 function testNoChangeForceSend() {
|
|
393
|
|
394 $oldMessage = <<<ICS
|
|
395 BEGIN:VCALENDAR
|
|
396 VERSION:2.0
|
|
397 BEGIN:VEVENT
|
|
398 UID:foobar
|
|
399 SEQUENCE:1
|
|
400 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
401 ATTENDEE;CN=One:mailto:one@example.org
|
|
402 DTSTART:20140716T120000Z
|
|
403 END:VEVENT
|
|
404 END:VCALENDAR
|
|
405 ICS;
|
|
406
|
|
407
|
|
408 $newMessage = <<<ICS
|
|
409 BEGIN:VCALENDAR
|
|
410 VERSION:2.0
|
|
411 BEGIN:VEVENT
|
|
412 UID:foobar
|
|
413 SEQUENCE:1
|
|
414 ORGANIZER;SCHEDULE-FORCE-SEND=REPLY;CN=Strunk:mailto:strunk@example.org
|
|
415 ATTENDEE;PARTSTAT=NEEDS-ACTION;CN=One:mailto:one@example.org
|
|
416 DTSTART:20140716T120000Z
|
|
417 END:VEVENT
|
|
418 END:VCALENDAR
|
|
419 ICS;
|
|
420
|
|
421 $version = \Sabre\VObject\Version::VERSION;
|
|
422 $expected = array(
|
|
423 array(
|
|
424 'uid' => 'foobar',
|
|
425 'method' => 'REPLY',
|
|
426 'component' => 'VEVENT',
|
|
427 'sender' => 'mailto:one@example.org',
|
|
428 'senderName' => 'One',
|
|
429 'recipient' => 'mailto:strunk@example.org',
|
|
430 'recipientName' => 'Strunk',
|
|
431 'message' => <<<ICS
|
|
432 BEGIN:VCALENDAR
|
|
433 VERSION:2.0
|
|
434 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
435 CALSCALE:GREGORIAN
|
|
436 METHOD:REPLY
|
|
437 BEGIN:VEVENT
|
|
438 UID:foobar
|
|
439 SEQUENCE:1
|
|
440 DTSTART:20140716T120000Z
|
|
441 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
442 ATTENDEE;PARTSTAT=NEEDS-ACTION;CN=One:mailto:one@example.org
|
|
443 END:VEVENT
|
|
444 END:VCALENDAR
|
|
445 ICS
|
|
446 )
|
|
447
|
|
448 );
|
|
449 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
450
|
|
451 }
|
|
452
|
|
453 function testNoRelevantAttendee() {
|
|
454
|
|
455 $oldMessage = <<<ICS
|
|
456 BEGIN:VCALENDAR
|
|
457 VERSION:2.0
|
|
458 BEGIN:VEVENT
|
|
459 UID:foobar
|
|
460 SEQUENCE:1
|
|
461 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
462 ATTENDEE;CN=Two:mailto:two@example.org
|
|
463 DTSTART:20140716T120000Z
|
|
464 END:VEVENT
|
|
465 END:VCALENDAR
|
|
466 ICS;
|
|
467
|
|
468
|
|
469 $newMessage = <<<ICS
|
|
470 BEGIN:VCALENDAR
|
|
471 VERSION:2.0
|
|
472 BEGIN:VEVENT
|
|
473 UID:foobar
|
|
474 SEQUENCE:1
|
|
475 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
476 ATTENDEE;PARTSTAT=ACCEPTED;CN=Two:mailto:two@example.org
|
|
477 DTSTART:20140716T120000Z
|
|
478 END:VEVENT
|
|
479 END:VCALENDAR
|
|
480 ICS;
|
|
481
|
|
482 $expected = array();
|
|
483 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
484
|
|
485 }
|
|
486
|
|
487 /**
|
|
488 * In this test, an event exists in an attendees calendar. The event
|
|
489 * is recurring, and the attendee deletes 1 instance of the event.
|
|
490 * This instance shows up in EXDATE
|
|
491 *
|
|
492 * This should automatically generate a DECLINED message for that
|
|
493 * specific instance.
|
|
494 */
|
|
495 function testCreateReplyByException() {
|
|
496
|
|
497
|
|
498 $oldMessage = <<<ICS
|
|
499 BEGIN:VCALENDAR
|
|
500 VERSION:2.0
|
|
501 BEGIN:VEVENT
|
|
502 UID:foobar
|
|
503 SEQUENCE:1
|
|
504 DTSTART:20140811T200000Z
|
|
505 RRULE:FREQ=WEEKLY
|
|
506 ORGANIZER:mailto:organizer@example.org
|
|
507 ATTENDEE:mailto:one@example.org
|
|
508 END:VEVENT
|
|
509 END:VCALENDAR
|
|
510 ICS;
|
|
511
|
|
512 $newMessage = <<<ICS
|
|
513 BEGIN:VCALENDAR
|
|
514 VERSION:2.0
|
|
515 BEGIN:VEVENT
|
|
516 UID:foobar
|
|
517 SEQUENCE:1
|
|
518 DTSTART:20140811T200000Z
|
|
519 RRULE:FREQ=WEEKLY
|
|
520 ORGANIZER:mailto:organizer@example.org
|
|
521 ATTENDEE:mailto:one@example.org
|
|
522 EXDATE:20140818T200000Z
|
|
523 END:VEVENT
|
|
524 END:VCALENDAR
|
|
525 ICS;
|
|
526
|
|
527 $version = \Sabre\VObject\Version::VERSION;
|
|
528 $expected = array(
|
|
529 array(
|
|
530 'uid' => 'foobar',
|
|
531 'method' => 'REPLY',
|
|
532 'component' => 'VEVENT',
|
|
533 'sender' => 'mailto:one@example.org',
|
|
534 'senderName' => null,
|
|
535 'recipient' => 'mailto:organizer@example.org',
|
|
536 'recipientName' => null,
|
|
537 'message' => <<<ICS
|
|
538 BEGIN:VCALENDAR
|
|
539 VERSION:2.0
|
|
540 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
541 CALSCALE:GREGORIAN
|
|
542 METHOD:REPLY
|
|
543 BEGIN:VEVENT
|
|
544 UID:foobar
|
|
545 SEQUENCE:1
|
|
546 DTSTART:20140818T200000Z
|
|
547 RECURRENCE-ID:20140818T200000Z
|
|
548 ORGANIZER:mailto:organizer@example.org
|
|
549 ATTENDEE;PARTSTAT=DECLINED:mailto:one@example.org
|
|
550 END:VEVENT
|
|
551 END:VCALENDAR
|
|
552 ICS
|
|
553
|
|
554 ),
|
|
555 );
|
|
556 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
557
|
|
558 }
|
|
559
|
|
560 /**
|
|
561 * This test is identical to the last, but now we're working with
|
|
562 * timezones.
|
|
563 *
|
|
564 * @depends testCreateReplyByException
|
|
565 */
|
|
566 function testCreateReplyByExceptionTz() {
|
|
567
|
|
568
|
|
569 $oldMessage = <<<ICS
|
|
570 BEGIN:VCALENDAR
|
|
571 VERSION:2.0
|
|
572 BEGIN:VEVENT
|
|
573 UID:foobar
|
|
574 SEQUENCE:1
|
|
575 DTSTART;TZID=America/Toronto:20140811T200000
|
|
576 RRULE:FREQ=WEEKLY
|
|
577 ORGANIZER:mailto:organizer@example.org
|
|
578 ATTENDEE:mailto:one@example.org
|
|
579 END:VEVENT
|
|
580 END:VCALENDAR
|
|
581 ICS;
|
|
582
|
|
583 $newMessage = <<<ICS
|
|
584 BEGIN:VCALENDAR
|
|
585 VERSION:2.0
|
|
586 BEGIN:VEVENT
|
|
587 UID:foobar
|
|
588 SEQUENCE:1
|
|
589 DTSTART;TZID=America/Toronto:20140811T200000
|
|
590 RRULE:FREQ=WEEKLY
|
|
591 ORGANIZER:mailto:organizer@example.org
|
|
592 ATTENDEE:mailto:one@example.org
|
|
593 EXDATE;TZID=America/Toronto:20140818T200000
|
|
594 END:VEVENT
|
|
595 END:VCALENDAR
|
|
596 ICS;
|
|
597
|
|
598 $version = \Sabre\VObject\Version::VERSION;
|
|
599 $expected = array(
|
|
600 array(
|
|
601 'uid' => 'foobar',
|
|
602 'method' => 'REPLY',
|
|
603 'component' => 'VEVENT',
|
|
604 'sender' => 'mailto:one@example.org',
|
|
605 'senderName' => null,
|
|
606 'recipient' => 'mailto:organizer@example.org',
|
|
607 'recipientName' => null,
|
|
608 'message' => <<<ICS
|
|
609 BEGIN:VCALENDAR
|
|
610 VERSION:2.0
|
|
611 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
612 CALSCALE:GREGORIAN
|
|
613 METHOD:REPLY
|
|
614 BEGIN:VEVENT
|
|
615 UID:foobar
|
|
616 SEQUENCE:1
|
|
617 DTSTART;TZID=America/Toronto:20140818T200000
|
|
618 RECURRENCE-ID;TZID=America/Toronto:20140818T200000
|
|
619 ORGANIZER:mailto:organizer@example.org
|
|
620 ATTENDEE;PARTSTAT=DECLINED:mailto:one@example.org
|
|
621 END:VEVENT
|
|
622 END:VCALENDAR
|
|
623 ICS
|
|
624
|
|
625 ),
|
|
626 );
|
|
627 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
628
|
|
629 }
|
|
630
|
|
631 /**
|
|
632 * @depends testCreateReplyByException
|
|
633 */
|
|
634 function testCreateReplyByExceptionAllDay() {
|
|
635
|
|
636
|
|
637 $oldMessage = <<<ICS
|
|
638 BEGIN:VCALENDAR
|
|
639 VERSION:2.0
|
|
640 BEGIN:VEVENT
|
|
641 SUMMARY:Weekly meeting
|
|
642 UID:foobar
|
|
643 SEQUENCE:1
|
|
644 DTSTART;VALUE=DATE:20140811
|
|
645 RRULE:FREQ=WEEKLY
|
|
646 ORGANIZER:mailto:organizer@example.org
|
|
647 ATTENDEE:mailto:one@example.org
|
|
648 END:VEVENT
|
|
649 END:VCALENDAR
|
|
650 ICS;
|
|
651
|
|
652 $newMessage = <<<ICS
|
|
653 BEGIN:VCALENDAR
|
|
654 VERSION:2.0
|
|
655 BEGIN:VEVENT
|
|
656 SUMMARY:Weekly meeting
|
|
657 UID:foobar
|
|
658 SEQUENCE:1
|
|
659 DTSTART;VALUE=DATE:20140811
|
|
660 RRULE:FREQ=WEEKLY
|
|
661 ORGANIZER:mailto:organizer@example.org
|
|
662 ATTENDEE:mailto:one@example.org
|
|
663 EXDATE;VALUE=DATE:20140818
|
|
664 END:VEVENT
|
|
665 END:VCALENDAR
|
|
666 ICS;
|
|
667
|
|
668 $version = \Sabre\VObject\Version::VERSION;
|
|
669 $expected = array(
|
|
670 array(
|
|
671 'uid' => 'foobar',
|
|
672 'method' => 'REPLY',
|
|
673 'component' => 'VEVENT',
|
|
674 'sender' => 'mailto:one@example.org',
|
|
675 'senderName' => null,
|
|
676 'recipient' => 'mailto:organizer@example.org',
|
|
677 'recipientName' => null,
|
|
678 'message' => <<<ICS
|
|
679 BEGIN:VCALENDAR
|
|
680 VERSION:2.0
|
|
681 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
682 CALSCALE:GREGORIAN
|
|
683 METHOD:REPLY
|
|
684 BEGIN:VEVENT
|
|
685 UID:foobar
|
|
686 SEQUENCE:1
|
|
687 DTSTART;VALUE=DATE:20140818
|
|
688 SUMMARY:Weekly meeting
|
|
689 RECURRENCE-ID;VALUE=DATE:20140818
|
|
690 ORGANIZER:mailto:organizer@example.org
|
|
691 ATTENDEE;PARTSTAT=DECLINED:mailto:one@example.org
|
|
692 END:VEVENT
|
|
693 END:VCALENDAR
|
|
694 ICS
|
|
695
|
|
696 ),
|
|
697 );
|
|
698 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
699
|
|
700 }
|
|
701
|
|
702 function testDeclined() {
|
|
703
|
|
704 $oldMessage = <<<ICS
|
|
705 BEGIN:VCALENDAR
|
|
706 VERSION:2.0
|
|
707 BEGIN:VEVENT
|
|
708 UID:foobar
|
|
709 SEQUENCE:1
|
|
710 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
711 ATTENDEE;CN=One:mailto:one@example.org
|
|
712 DTSTART:20140716T120000Z
|
|
713 END:VEVENT
|
|
714 END:VCALENDAR
|
|
715 ICS;
|
|
716
|
|
717
|
|
718 $newMessage = <<<ICS
|
|
719 BEGIN:VCALENDAR
|
|
720 VERSION:2.0
|
|
721 BEGIN:VEVENT
|
|
722 UID:foobar
|
|
723 SEQUENCE:1
|
|
724 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
725 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
726 DTSTART:20140716T120000Z
|
|
727 END:VEVENT
|
|
728 END:VCALENDAR
|
|
729 ICS;
|
|
730
|
|
731 $version = \Sabre\VObject\Version::VERSION;
|
|
732
|
|
733 $expected = array(
|
|
734 array(
|
|
735 'uid' => 'foobar',
|
|
736 'method' => 'REPLY',
|
|
737 'component' => 'VEVENT',
|
|
738 'sender' => 'mailto:one@example.org',
|
|
739 'senderName' => 'One',
|
|
740 'recipient' => 'mailto:strunk@example.org',
|
|
741 'recipientName' => 'Strunk',
|
|
742 'message' => <<<ICS
|
|
743 BEGIN:VCALENDAR
|
|
744 VERSION:2.0
|
|
745 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
746 CALSCALE:GREGORIAN
|
|
747 METHOD:REPLY
|
|
748 BEGIN:VEVENT
|
|
749 UID:foobar
|
|
750 SEQUENCE:1
|
|
751 DTSTART:20140716T120000Z
|
|
752 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
753 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
754 END:VEVENT
|
|
755 END:VCALENDAR
|
|
756 ICS
|
|
757
|
|
758 ),
|
|
759
|
|
760 );
|
|
761
|
|
762 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
763
|
|
764 }
|
|
765
|
|
766 function testDeclinedCancelledEvent() {
|
|
767
|
|
768 $oldMessage = <<<ICS
|
|
769 BEGIN:VCALENDAR
|
|
770 VERSION:2.0
|
|
771 BEGIN:VEVENT
|
|
772 STATUS:CANCELLED
|
|
773 UID:foobar
|
|
774 SEQUENCE:1
|
|
775 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
776 ATTENDEE;CN=One:mailto:one@example.org
|
|
777 DTSTART:20140716T120000Z
|
|
778 END:VEVENT
|
|
779 END:VCALENDAR
|
|
780 ICS;
|
|
781
|
|
782
|
|
783 $newMessage = <<<ICS
|
|
784 BEGIN:VCALENDAR
|
|
785 VERSION:2.0
|
|
786 BEGIN:VEVENT
|
|
787 STATUS:CANCELLED
|
|
788 UID:foobar
|
|
789 SEQUENCE:1
|
|
790 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
791 ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org
|
|
792 DTSTART:20140716T120000Z
|
|
793 END:VEVENT
|
|
794 END:VCALENDAR
|
|
795 ICS;
|
|
796
|
|
797 $version = \Sabre\VObject\Version::VERSION;
|
|
798
|
|
799 $expected = array();
|
|
800
|
|
801 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
802
|
|
803 }
|
|
804
|
|
805 /**
|
|
806 * In this test, a new exception is created by an attendee as well.
|
|
807 *
|
|
808 * Except in this case, there was already an overridden event, and the
|
|
809 * overridden event was marked as cancelled by the attendee.
|
|
810 *
|
|
811 * For any other attendence status, the new status would have been
|
|
812 * declined, but for this, no message should we sent.
|
|
813 */
|
|
814 function testDontCreateReplyWhenEventWasDeclined() {
|
|
815
|
|
816
|
|
817 $oldMessage = <<<ICS
|
|
818 BEGIN:VCALENDAR
|
|
819 VERSION:2.0
|
|
820 BEGIN:VEVENT
|
|
821 UID:foobar
|
|
822 SEQUENCE:1
|
|
823 DTSTART:20140811T200000Z
|
|
824 RRULE:FREQ=WEEKLY
|
|
825 ORGANIZER:mailto:organizer@example.org
|
|
826 ATTENDEE:mailto:one@example.org
|
|
827 END:VEVENT
|
|
828 BEGIN:VEVENT
|
|
829 RECURRENCE-ID:20140818T200000Z
|
|
830 UID:foobar
|
|
831 SEQUENCE:1
|
|
832 DTSTART:20140818T200000Z
|
|
833 RRULE:FREQ=WEEKLY
|
|
834 ORGANIZER:mailto:organizer@example.org
|
|
835 ATTENDEE;PARTSTAT=DECLINED:mailto:one@example.org
|
|
836 END:VEVENT
|
|
837 END:VCALENDAR
|
|
838 ICS;
|
|
839
|
|
840 $newMessage = <<<ICS
|
|
841 BEGIN:VCALENDAR
|
|
842 VERSION:2.0
|
|
843 BEGIN:VEVENT
|
|
844 UID:foobar
|
|
845 SEQUENCE:1
|
|
846 DTSTART:20140811T200000Z
|
|
847 RRULE:FREQ=WEEKLY
|
|
848 ORGANIZER:mailto:organizer@example.org
|
|
849 ATTENDEE:mailto:one@example.org
|
|
850 EXDATE:20140818T200000Z
|
|
851 END:VEVENT
|
|
852 END:VCALENDAR
|
|
853 ICS;
|
|
854
|
|
855 $version = \Sabre\VObject\Version::VERSION;
|
|
856 $expected = array();
|
|
857
|
|
858 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
859
|
|
860 }
|
|
861
|
|
862 function testScheduleAgentOnOrganizer() {
|
|
863
|
|
864 $oldMessage = <<<ICS
|
|
865 BEGIN:VCALENDAR
|
|
866 VERSION:2.0
|
|
867 BEGIN:VEVENT
|
|
868 UID:foobar
|
|
869 SEQUENCE:1
|
|
870 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
871 ATTENDEE;CN=One:mailto:one@example.org
|
|
872 DTSTART:20140716T120000Z
|
|
873 END:VEVENT
|
|
874 END:VCALENDAR
|
|
875 ICS;
|
|
876
|
|
877
|
|
878 $newMessage = <<<ICS
|
|
879 BEGIN:VCALENDAR
|
|
880 VERSION:2.0
|
|
881 BEGIN:VEVENT
|
|
882 UID:foobar
|
|
883 SEQUENCE:1
|
|
884 ORGANIZER;SCHEDULE-AGENT=CLIENT;CN=Strunk:mailto:strunk@example.org
|
|
885 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
886 DTSTART:20140716T120000Z
|
|
887 END:VEVENT
|
|
888 END:VCALENDAR
|
|
889 ICS;
|
|
890
|
|
891 $version = \Sabre\VObject\Version::VERSION;
|
|
892
|
|
893 $expected = array();
|
|
894 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
895
|
|
896 }
|
|
897
|
|
898 function testAcceptedAllDay() {
|
|
899
|
|
900 $oldMessage = <<<ICS
|
|
901 BEGIN:VCALENDAR
|
|
902 VERSION:2.0
|
|
903 BEGIN:VEVENT
|
|
904 UID:foobar
|
|
905 SEQUENCE:1
|
|
906 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
907 ATTENDEE;CN=One:mailto:one@example.org
|
|
908 DTSTART;VALUE=DATE:20140716
|
|
909 END:VEVENT
|
|
910 END:VCALENDAR
|
|
911 ICS;
|
|
912
|
|
913
|
|
914 $newMessage = <<<ICS
|
|
915 BEGIN:VCALENDAR
|
|
916 VERSION:2.0
|
|
917 BEGIN:VEVENT
|
|
918 UID:foobar
|
|
919 SEQUENCE:1
|
|
920 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
921 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
922 DTSTART;VALUE=DATE:20140716
|
|
923 END:VEVENT
|
|
924 END:VCALENDAR
|
|
925 ICS;
|
|
926
|
|
927 $version = \Sabre\VObject\Version::VERSION;
|
|
928
|
|
929 $expected = array(
|
|
930 array(
|
|
931 'uid' => 'foobar',
|
|
932 'method' => 'REPLY',
|
|
933 'component' => 'VEVENT',
|
|
934 'sender' => 'mailto:one@example.org',
|
|
935 'senderName' => 'One',
|
|
936 'recipient' => 'mailto:strunk@example.org',
|
|
937 'recipientName' => 'Strunk',
|
|
938 'message' => <<<ICS
|
|
939 BEGIN:VCALENDAR
|
|
940 VERSION:2.0
|
|
941 PRODID:-//Sabre//Sabre VObject $version//EN
|
|
942 CALSCALE:GREGORIAN
|
|
943 METHOD:REPLY
|
|
944 BEGIN:VEVENT
|
|
945 UID:foobar
|
|
946 SEQUENCE:1
|
|
947 DTSTART;VALUE=DATE:20140716
|
|
948 ORGANIZER;CN=Strunk:mailto:strunk@example.org
|
|
949 ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
|
|
950 END:VEVENT
|
|
951 END:VCALENDAR
|
|
952 ICS
|
|
953
|
|
954 ),
|
|
955
|
|
956 );
|
|
957
|
|
958 $result = $this->parse($oldMessage, $newMessage, $expected);
|
|
959
|
|
960 }
|
|
961
|
|
962 }
|