ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
BrokerProcessReplyTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\VObject\ITip;
4 
6 
7  function testReplyNoOriginal() {
8 
9  $itip = <<<ICS
10 BEGIN:VCALENDAR
11 VERSION:2.0
12 METHOD:REPLY
13 BEGIN:VEVENT
14 SEQUENCE:2
15 UID:foobar
16 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
17 ORGANIZER:mailto:bar@example.org
18 END:VEVENT
19 END:VCALENDAR
20 ICS;
21 
22  $old = null;
23  $expected = null;
24 
25  $result = $this->process($itip, $old, $expected);
26 
27  }
28 
29  function testReplyAccept() {
30 
31  $itip = <<<ICS
32 BEGIN:VCALENDAR
33 VERSION:2.0
34 METHOD:REPLY
35 BEGIN:VEVENT
36 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
37 ORGANIZER:mailto:bar@example.org
38 SEQUENCE:2
39 UID:foobar
40 END:VEVENT
41 END:VCALENDAR
42 ICS;
43 
44  $old = <<<ICS
45 BEGIN:VCALENDAR
46 VERSION:2.0
47 BEGIN:VEVENT
48 SEQUENCE:2
49 UID:foobar
50 ATTENDEE:mailto:foo@example.org
51 ORGANIZER:mailto:bar@example.org
52 END:VEVENT
53 END:VCALENDAR
54 ICS;
55 
56  $expected = <<<ICS
57 BEGIN:VCALENDAR
58 VERSION:2.0
59 BEGIN:VEVENT
60 SEQUENCE:2
61 UID:foobar
62 ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:foo@example.org
63 ORGANIZER:mailto:bar@example.org
64 END:VEVENT
65 END:VCALENDAR
66 ICS;
67 
68  $result = $this->process($itip, $old, $expected);
69 
70  }
71 
73 
74  $itip = <<<ICS
75 BEGIN:VCALENDAR
76 VERSION:2.0
77 METHOD:REPLY
78 BEGIN:VEVENT
79 UID:foobar
80 REQUEST-STATUS:2.3;foo-bar!
81 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
82 ORGANIZER:mailto:bar@example.org
83 SEQUENCE:2
84 UID:foobar
85 END:VEVENT
86 END:VCALENDAR
87 ICS;
88 
89  $old = <<<ICS
90 BEGIN:VCALENDAR
91 VERSION:2.0
92 BEGIN:VEVENT
93 UID:foobar
94 SEQUENCE:2
95 ATTENDEE:mailto:foo@example.org
96 ORGANIZER:mailto:bar@example.org
97 END:VEVENT
98 END:VCALENDAR
99 ICS;
100 
101  $expected = <<<ICS
102 BEGIN:VCALENDAR
103 VERSION:2.0
104 BEGIN:VEVENT
105 UID:foobar
106 SEQUENCE:2
107 ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.3:mailto:foo@example.org
108 ORGANIZER:mailto:bar@example.org
109 END:VEVENT
110 END:VCALENDAR
111 ICS;
112 
113  $result = $this->process($itip, $old, $expected);
114 
115  }
116 
117 
119 
120  $itip = <<<ICS
121 BEGIN:VCALENDAR
122 VERSION:2.0
123 METHOD:REPLY
124 BEGIN:VEVENT
125 ATTENDEE;PARTSTAT=ACCEPTED:mailto:crasher@example.org
126 ORGANIZER:mailto:bar@example.org
127 SEQUENCE:2
128 UID:foobar
129 END:VEVENT
130 END:VCALENDAR
131 ICS;
132 
133  $old = <<<ICS
134 BEGIN:VCALENDAR
135 VERSION:2.0
136 BEGIN:VEVENT
137 SEQUENCE:2
138 UID:foobar
139 ATTENDEE:mailto:foo@example.org
140 ORGANIZER:mailto:bar@example.org
141 END:VEVENT
142 END:VCALENDAR
143 ICS;
144 
145  $expected = <<<ICS
146 BEGIN:VCALENDAR
147 VERSION:2.0
148 BEGIN:VEVENT
149 SEQUENCE:2
150 UID:foobar
151 ATTENDEE:mailto:foo@example.org
152 ORGANIZER:mailto:bar@example.org
153 ATTENDEE;PARTSTAT=ACCEPTED:mailto:crasher@example.org
154 END:VEVENT
155 END:VCALENDAR
156 ICS;
157 
158  $result = $this->process($itip, $old, $expected);
159 
160  }
161 
163 
164  // This is a reply to 1 instance of a recurring event. This should
165  // automatically create an exception.
166  $itip = <<<ICS
167 BEGIN:VCALENDAR
168 VERSION:2.0
169 METHOD:REPLY
170 BEGIN:VEVENT
171 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
172 ORGANIZER:mailto:bar@example.org
173 SEQUENCE:2
174 RECURRENCE-ID:20140725T000000Z
175 UID:foobar
176 END:VEVENT
177 END:VCALENDAR
178 ICS;
179 
180  $old = <<<ICS
181 BEGIN:VCALENDAR
182 VERSION:2.0
183 BEGIN:VEVENT
184 SEQUENCE:2
185 UID:foobar
186 RRULE:FREQ=DAILY
187 DTSTART:20140724T000000Z
188 DTEND:20140724T010000Z
189 ATTENDEE:mailto:foo@example.org
190 ORGANIZER:mailto:bar@example.org
191 END:VEVENT
192 END:VCALENDAR
193 ICS;
194 
195  $expected = <<<ICS
196 BEGIN:VCALENDAR
197 VERSION:2.0
198 BEGIN:VEVENT
199 SEQUENCE:2
200 UID:foobar
201 RRULE:FREQ=DAILY
202 DTSTART:20140724T000000Z
203 DTEND:20140724T010000Z
204 ATTENDEE:mailto:foo@example.org
205 ORGANIZER:mailto:bar@example.org
206 END:VEVENT
207 BEGIN:VEVENT
208 SEQUENCE:2
209 UID:foobar
210 DTSTART:20140725T000000Z
211 DTEND:20140725T010000Z
212 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
213 ORGANIZER:mailto:bar@example.org
214 RECURRENCE-ID:20140725T000000Z
215 END:VEVENT
216 END:VCALENDAR
217 ICS;
218 
219  $result = $this->process($itip, $old, $expected);
220 
221  }
222 
224 
225  // This is a reply to 1 instance of a recurring event. This should
226  // automatically create an exception.
227  $itip = <<<ICS
228 BEGIN:VCALENDAR
229 VERSION:2.0
230 METHOD:REPLY
231 BEGIN:VEVENT
232 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
233 ORGANIZER:mailto:bar@example.org
234 SEQUENCE:2
235 RECURRENCE-ID;TZID=America/Toronto:20140725T000000
236 UID:foobar
237 END:VEVENT
238 END:VCALENDAR
239 ICS;
240 
241  $old = <<<ICS
242 BEGIN:VCALENDAR
243 VERSION:2.0
244 BEGIN:VEVENT
245 SEQUENCE:2
246 UID:foobar
247 RRULE:FREQ=DAILY
248 DTSTART;TZID=America/Toronto:20140724T000000
249 DTEND;TZID=America/Toronto:20140724T010000
250 ATTENDEE:mailto:foo@example.org
251 ORGANIZER:mailto:bar@example.org
252 END:VEVENT
253 END:VCALENDAR
254 ICS;
255 
256  $expected = <<<ICS
257 BEGIN:VCALENDAR
258 VERSION:2.0
259 BEGIN:VEVENT
260 SEQUENCE:2
261 UID:foobar
262 RRULE:FREQ=DAILY
263 DTSTART;TZID=America/Toronto:20140724T000000
264 DTEND;TZID=America/Toronto:20140724T010000
265 ATTENDEE:mailto:foo@example.org
266 ORGANIZER:mailto:bar@example.org
267 END:VEVENT
268 BEGIN:VEVENT
269 SEQUENCE:2
270 UID:foobar
271 DTSTART;TZID=America/Toronto:20140725T000000
272 DTEND;TZID=America/Toronto:20140725T010000
273 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
274 ORGANIZER:mailto:bar@example.org
275 RECURRENCE-ID;TZID=America/Toronto:20140725T000000
276 END:VEVENT
277 END:VCALENDAR
278 ICS;
279 
280  $result = $this->process($itip, $old, $expected);
281 
282  }
283 
285 
286  // IN this test there's a recurring event that has an exception. The
287  // exception is missing the attendee.
288  //
289  // The attendee party crashes the instance, so it should show up in the
290  // resulting object.
291  $itip = <<<ICS
292 BEGIN:VCALENDAR
293 VERSION:2.0
294 METHOD:REPLY
295 BEGIN:VEVENT
296 ATTENDEE;PARTSTAT=ACCEPTED;CN=Crasher!:mailto:crasher@example.org
297 ORGANIZER:mailto:bar@example.org
298 SEQUENCE:2
299 RECURRENCE-ID:20140725T000000Z
300 UID:foobar
301 END:VEVENT
302 END:VCALENDAR
303 ICS;
304 
305  $old = <<<ICS
306 BEGIN:VCALENDAR
307 VERSION:2.0
308 BEGIN:VEVENT
309 SEQUENCE:2
310 UID:foobar
311 RRULE:FREQ=DAILY
312 DTSTART:20140724T000000Z
313 DTEND:20140724T010000Z
314 ORGANIZER:mailto:bar@example.org
315 END:VEVENT
316 END:VCALENDAR
317 ICS;
318 
319  $expected = <<<ICS
320 BEGIN:VCALENDAR
321 VERSION:2.0
322 BEGIN:VEVENT
323 SEQUENCE:2
324 UID:foobar
325 RRULE:FREQ=DAILY
326 DTSTART:20140724T000000Z
327 DTEND:20140724T010000Z
328 ORGANIZER:mailto:bar@example.org
329 END:VEVENT
330 BEGIN:VEVENT
331 SEQUENCE:2
332 UID:foobar
333 DTSTART:20140725T000000Z
334 DTEND:20140725T010000Z
335 ORGANIZER:mailto:bar@example.org
336 RECURRENCE-ID:20140725T000000Z
337 ATTENDEE;PARTSTAT=ACCEPTED;CN=Crasher!:mailto:crasher@example.org
338 END:VEVENT
339 END:VCALENDAR
340 ICS;
341 
342  $result = $this->process($itip, $old, $expected);
343 
344  }
345 
347 
355  $itip = <<<ICS
356 BEGIN:VCALENDAR
357 VERSION:2.0
358 METHOD:REPLY
359 BEGIN:VEVENT
360 ATTENDEE;PARTSTAT=ACCEPTED;CN=Crasher!:mailto:crasher@example.org
361 ORGANIZER:mailto:bar@example.org
362 SEQUENCE:2
363 RECURRENCE-ID:20140725T000000Z
364 UID:foobar
365 END:VEVENT
366 END:VCALENDAR
367 ICS;
368 
369  $old = <<<ICS
370 BEGIN:VCALENDAR
371 VERSION:2.0
372 BEGIN:VEVENT
373 SEQUENCE:2
374 UID:foobar
375 RRULE:FREQ=DAILY
376 DTSTART:20140724T000000Z
377 DTEND:20140724T010000Z
378 RECURRENCE-ID:20140724T000000Z
379 ORGANIZER:mailto:bar@example.org
380 END:VEVENT
381 END:VCALENDAR
382 ICS;
383 
384  $expected = null;
385  $result = $this->process($itip, $old, $expected);
386 
387  }
388 
393 
394  $itip = <<<ICS
395 BEGIN:VCALENDAR
396 VERSION:2.0
397 METHOD:REPLY
398 BEGIN:VEVENT
399 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
400 ORGANIZER:mailto:bar@example.org
401 SEQUENCE:2
402 UID:foobar
403 END:VEVENT
404 END:VCALENDAR
405 ICS;
406 
407  $old = <<<ICS
408 BEGIN:VCALENDAR
409 VERSION:2.0
410 BEGIN:VEVENT
411 SEQUENCE:2
412 UID:foobar
413 ATTENDEE;RSVP=TRUE:mailto:foo@example.org
414 ORGANIZER:mailto:bar@example.org
415 END:VEVENT
416 END:VCALENDAR
417 ICS;
418 
419  $expected = <<<ICS
420 BEGIN:VCALENDAR
421 VERSION:2.0
422 BEGIN:VEVENT
423 SEQUENCE:2
424 UID:foobar
425 ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:foo@example.org
426 ORGANIZER:mailto:bar@example.org
427 END:VEVENT
428 END:VCALENDAR
429 ICS;
430 
431  $result = $this->process($itip, $old, $expected);
432 
433  }
434 
436 
437  // This is a reply to 1 instance of a recurring event. This should
438  // automatically create an exception.
439  $itip = <<<ICS
440 BEGIN:VCALENDAR
441 VERSION:2.0
442 METHOD:REPLY
443 BEGIN:VEVENT
444 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
445 ORGANIZER:mailto:bar@example.org
446 SEQUENCE:2
447 RECURRENCE-ID:20140724T000000Z
448 UID:foobar
449 END:VEVENT
450 END:VCALENDAR
451 ICS;
452 
453  $old = <<<ICS
454 BEGIN:VCALENDAR
455 VERSION:2.0
456 BEGIN:VEVENT
457 SEQUENCE:2
458 UID:foobar
459 RRULE:FREQ=DAILY
460 DTSTART:20140724T000000Z
461 DTEND:20140724T010000Z
462 ATTENDEE:mailto:foo@example.org
463 ORGANIZER:mailto:bar@example.org
464 END:VEVENT
465 END:VCALENDAR
466 ICS;
467 
468  $expected = <<<ICS
469 BEGIN:VCALENDAR
470 VERSION:2.0
471 BEGIN:VEVENT
472 SEQUENCE:2
473 UID:foobar
474 RRULE:FREQ=DAILY
475 DTSTART:20140724T000000Z
476 DTEND:20140724T010000Z
477 ATTENDEE:mailto:foo@example.org
478 ORGANIZER:mailto:bar@example.org
479 END:VEVENT
480 BEGIN:VEVENT
481 SEQUENCE:2
482 UID:foobar
483 DTSTART:20140724T000000Z
484 DTEND:20140724T010000Z
485 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org
486 ORGANIZER:mailto:bar@example.org
487 RECURRENCE-ID:20140724T000000Z
488 END:VEVENT
489 END:VCALENDAR
490 ICS;
491 
492  $result = $this->process($itip, $old, $expected);
493 
494  }
495 
496 }
$result
process($input, $existingObject=null, $expected=false)
Utilities for testing the broker.