ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
BrokerNewEventTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\VObject\ITip;
4 
6 
7  function testNoAttendee() {
8 
9  $message = <<<ICS
10 BEGIN:VCALENDAR
11 BEGIN:VEVENT
12 UID:foobar
13 DTSTART:20140811T220000Z
14 DTEND:20140811T230000Z
15 END:VEVENT
16 END:VCALENDAR
17 ICS;
18 
19  $result = $this->parse(null, $message, []);
20 
21  }
22 
23  function testVTODO() {
24 
25  $message = <<<ICS
26 BEGIN:VCALENDAR
27 BEGIN:VTODO
28 UID:foobar
29 END:VTODO
30 END:VCALENDAR
31 ICS;
32 
33  $result = $this->parse(null, $message, []);
34 
35  }
36 
37  function testSimpleInvite() {
38 
39  $message = <<<ICS
40 BEGIN:VCALENDAR
41 VERSION:2.0
42 BEGIN:VEVENT
43 UID:foobar
44 DTSTART:20140811T220000Z
45 DTEND:20140811T230000Z
46 ORGANIZER;CN=Strunk:mailto:strunk@example.org
47 ATTENDEE;CN=White:mailto:white@example.org
48 END:VEVENT
49 END:VCALENDAR
50 ICS;
51 
53  $expectedMessage = <<<ICS
54 BEGIN:VCALENDAR
55 VERSION:2.0
56 PRODID:-//Sabre//Sabre VObject $version//EN
57 CALSCALE:GREGORIAN
58 METHOD:REQUEST
59 BEGIN:VEVENT
60 UID:foobar
61 DTSTART:20140811T220000Z
62 DTEND:20140811T230000Z
63 ORGANIZER;CN=Strunk:mailto:strunk@example.org
64 ATTENDEE;CN=White;PARTSTAT=NEEDS-ACTION:mailto:white@example.org
65 END:VEVENT
66 END:VCALENDAR
67 ICS;
68 
69  $expected = [
70  [
71  'uid' => 'foobar',
72  'method' => 'REQUEST',
73  'component' => 'VEVENT',
74  'sender' => 'mailto:strunk@example.org',
75  'senderName' => 'Strunk',
76  'recipient' => 'mailto:white@example.org',
77  'recipientName' => 'White',
78  'message' => $expectedMessage,
79  ],
80  ];
81 
82  $this->parse(null, $message, $expected, 'mailto:strunk@example.org');
83 
84  }
85 
90 
91  $message = <<<ICS
92 BEGIN:VCALENDAR
93 VERSION:2.0
94 BEGIN:VEVENT
95 UID:foobar
96 ORGANIZER;CN=Strunk:mailto:strunk@example.org
97 ATTENDEE;CN=White:mailto:white@example.org
98 END:VEVENT
99 BEGIN:VEVENT
100 UID:foobar2
101 ORGANIZER;CN=Strunk:mailto:strunk@example.org
102 ATTENDEE;CN=White:mailto:white@example.org
103 END:VEVENT
104 END:VCALENDAR
105 ICS;
106 
107  $this->parse(null, $message, [], 'mailto:strunk@example.org');
108 
109  }
114 
115  $message = <<<ICS
116 BEGIN:VCALENDAR
117 VERSION:2.0
118 BEGIN:VEVENT
119 UID:foobar
120 ORGANIZER;CN=Strunk:mailto:strunk@example.org
121 ATTENDEE;CN=White:mailto:white@example.org
122 END:VEVENT
123 BEGIN:VEVENT
124 UID:foobar
125 ORGANIZER:mailto:foo@example.org
126 ATTENDEE;CN=White:mailto:white@example.org
127 END:VEVENT
128 END:VCALENDAR
129 ICS;
130 
131  $this->parse(null, $message, [], 'mailto:strunk@example.org');
132 
133  }
134 
135  function testRecurrenceInvite() {
136 
137  $message = <<<ICS
138 BEGIN:VCALENDAR
139 VERSION:2.0
140 BEGIN:VEVENT
141 UID:foobar
142 ORGANIZER;CN=Strunk:mailto:strunk@example.org
143 ATTENDEE;CN=One:mailto:one@example.org
144 ATTENDEE;CN=Two:mailto:two@example.org
145 DTSTART:20140716T120000Z
146 DURATION:PT1H
147 RRULE:FREQ=DAILY
148 EXDATE:20140717T120000Z
149 END:VEVENT
150 BEGIN:VEVENT
151 UID:foobar
152 RECURRENCE-ID:20140718T120000Z
153 ORGANIZER;CN=Strunk:mailto:strunk@example.org
154 ATTENDEE;CN=Two:mailto:two@example.org
155 ATTENDEE;CN=Three:mailto:three@example.org
156 DTSTART:20140718T120000Z
157 DURATION:PT1H
158 END:VEVENT
159 END:VCALENDAR
160 ICS;
161 
163 
164  $expected = [
165  [
166  'uid' => 'foobar',
167  'method' => 'REQUEST',
168  'component' => 'VEVENT',
169  'sender' => 'mailto:strunk@example.org',
170  'senderName' => 'Strunk',
171  'recipient' => 'mailto:one@example.org',
172  'recipientName' => 'One',
173  'message' => <<<ICS
174 BEGIN:VCALENDAR
175 VERSION:2.0
176 PRODID:-//Sabre//Sabre VObject $version//EN
177 CALSCALE:GREGORIAN
178 METHOD:REQUEST
179 BEGIN:VEVENT
180 UID:foobar
181 ORGANIZER;CN=Strunk:mailto:strunk@example.org
182 ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
183 ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
184 DTSTART:20140716T120000Z
185 DURATION:PT1H
186 RRULE:FREQ=DAILY
187 EXDATE:20140717T120000Z,20140718T120000Z
188 END:VEVENT
189 END:VCALENDAR
190 ICS
191 
192  ],
193  [
194  'uid' => 'foobar',
195  'method' => 'REQUEST',
196  'component' => 'VEVENT',
197  'sender' => 'mailto:strunk@example.org',
198  'senderName' => 'Strunk',
199  'recipient' => 'mailto:two@example.org',
200  'recipientName' => 'Two',
201  'message' => <<<ICS
202 BEGIN:VCALENDAR
203 VERSION:2.0
204 PRODID:-//Sabre//Sabre VObject $version//EN
205 CALSCALE:GREGORIAN
206 METHOD:REQUEST
207 BEGIN:VEVENT
208 UID:foobar
209 ORGANIZER;CN=Strunk:mailto:strunk@example.org
210 ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
211 ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
212 DTSTART:20140716T120000Z
213 DURATION:PT1H
214 RRULE:FREQ=DAILY
215 EXDATE:20140717T120000Z
216 END:VEVENT
217 BEGIN:VEVENT
218 UID:foobar
219 RECURRENCE-ID:20140718T120000Z
220 ORGANIZER;CN=Strunk:mailto:strunk@example.org
221 ATTENDEE;CN=Two:mailto:two@example.org
222 ATTENDEE;CN=Three:mailto:three@example.org
223 DTSTART:20140718T120000Z
224 DURATION:PT1H
225 END:VEVENT
226 END:VCALENDAR
227 ICS
228 
229  ],
230  [
231  'uid' => 'foobar',
232  'method' => 'REQUEST',
233  'component' => 'VEVENT',
234  'sender' => 'mailto:strunk@example.org',
235  'senderName' => 'Strunk',
236  'recipient' => 'mailto:three@example.org',
237  'recipientName' => 'Three',
238  'message' => <<<ICS
239 BEGIN:VCALENDAR
240 VERSION:2.0
241 PRODID:-//Sabre//Sabre VObject $version//EN
242 CALSCALE:GREGORIAN
243 METHOD:REQUEST
244 BEGIN:VEVENT
245 UID:foobar
246 RECURRENCE-ID:20140718T120000Z
247 ORGANIZER;CN=Strunk:mailto:strunk@example.org
248 ATTENDEE;CN=Two:mailto:two@example.org
249 ATTENDEE;CN=Three:mailto:three@example.org
250 DTSTART:20140718T120000Z
251 DURATION:PT1H
252 END:VEVENT
253 END:VCALENDAR
254 ICS
255 
256  ],
257  ];
258 
259  $this->parse(null, $message, $expected, 'mailto:strunk@example.org');
260 
261  }
262 
264 
265  // This method tests a nearly identical path, but in this case the
266  // master event does not have an EXDATE.
267  $message = <<<ICS
268 BEGIN:VCALENDAR
269 VERSION:2.0
270 BEGIN:VEVENT
271 UID:foobar
272 ORGANIZER;CN=Strunk:mailto:strunk@example.org
273 ATTENDEE;CN=One:mailto:one@example.org
274 ATTENDEE;CN=Two:mailto:two@example.org
275 DTSTART:20140716T120000Z
276 DTEND:20140716T130000Z
277 RRULE:FREQ=DAILY
278 END:VEVENT
279 BEGIN:VEVENT
280 UID:foobar
281 RECURRENCE-ID:20140718T120000Z
282 ORGANIZER;CN=Strunk:mailto:strunk@example.org
283 ATTENDEE;CN=Two:mailto:two@example.org
284 ATTENDEE;CN=Three:mailto:three@example.org
285 DTSTART:20140718T120000Z
286 DTEND:20140718T130000Z
287 END:VEVENT
288 END:VCALENDAR
289 ICS;
290 
292 
293  $expected = [
294  [
295  'uid' => 'foobar',
296  'method' => 'REQUEST',
297  'component' => 'VEVENT',
298  'sender' => 'mailto:strunk@example.org',
299  'senderName' => 'Strunk',
300  'recipient' => 'mailto:one@example.org',
301  'recipientName' => 'One',
302  'message' => <<<ICS
303 BEGIN:VCALENDAR
304 VERSION:2.0
305 PRODID:-//Sabre//Sabre VObject $version//EN
306 CALSCALE:GREGORIAN
307 METHOD:REQUEST
308 BEGIN:VEVENT
309 UID:foobar
310 ORGANIZER;CN=Strunk:mailto:strunk@example.org
311 ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
312 ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
313 DTSTART:20140716T120000Z
314 DTEND:20140716T130000Z
315 RRULE:FREQ=DAILY
316 EXDATE:20140718T120000Z
317 END:VEVENT
318 END:VCALENDAR
319 ICS
320 
321  ],
322  [
323  'uid' => 'foobar',
324  'method' => 'REQUEST',
325  'component' => 'VEVENT',
326  'sender' => 'mailto:strunk@example.org',
327  'senderName' => 'Strunk',
328  'recipient' => 'mailto:two@example.org',
329  'recipientName' => 'Two',
330  'message' => <<<ICS
331 BEGIN:VCALENDAR
332 VERSION:2.0
333 PRODID:-//Sabre//Sabre VObject $version//EN
334 CALSCALE:GREGORIAN
335 METHOD:REQUEST
336 BEGIN:VEVENT
337 UID:foobar
338 ORGANIZER;CN=Strunk:mailto:strunk@example.org
339 ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
340 ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
341 DTSTART:20140716T120000Z
342 DTEND:20140716T130000Z
343 RRULE:FREQ=DAILY
344 END:VEVENT
345 BEGIN:VEVENT
346 UID:foobar
347 RECURRENCE-ID:20140718T120000Z
348 ORGANIZER;CN=Strunk:mailto:strunk@example.org
349 ATTENDEE;CN=Two:mailto:two@example.org
350 ATTENDEE;CN=Three:mailto:three@example.org
351 DTSTART:20140718T120000Z
352 DTEND:20140718T130000Z
353 END:VEVENT
354 END:VCALENDAR
355 ICS
356 
357  ],
358  [
359  'uid' => 'foobar',
360  'method' => 'REQUEST',
361  'component' => 'VEVENT',
362  'sender' => 'mailto:strunk@example.org',
363  'senderName' => 'Strunk',
364  'recipient' => 'mailto:three@example.org',
365  'recipientName' => 'Three',
366  'message' => <<<ICS
367 BEGIN:VCALENDAR
368 VERSION:2.0
369 PRODID:-//Sabre//Sabre VObject $version//EN
370 CALSCALE:GREGORIAN
371 METHOD:REQUEST
372 BEGIN:VEVENT
373 UID:foobar
374 RECURRENCE-ID:20140718T120000Z
375 ORGANIZER;CN=Strunk:mailto:strunk@example.org
376 ATTENDEE;CN=Two:mailto:two@example.org
377 ATTENDEE;CN=Three:mailto:three@example.org
378 DTSTART:20140718T120000Z
379 DTEND:20140718T130000Z
380 END:VEVENT
381 END:VCALENDAR
382 ICS
383 
384  ],
385  ];
386 
387  $this->parse(null, $message, $expected, 'mailto:strunk@example.org');
388 
389  }
390 
392 
393  // This method tests a complex rrule
394  $message = <<<ICS
395 BEGIN:VCALENDAR
396 VERSION:2.0
397 BEGIN:VEVENT
398 UID:foobar
399 ORGANIZER;CN=Strunk:mailto:strunk@example.org
400 ATTENDEE;CN=One:mailto:one@example.org
401 DTSTART:20140716T120000Z
402 DTEND:20140716T130000Z
403 RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=8;BYDAY=SA,SU
404 END:VEVENT
405 END:VCALENDAR
406 ICS;
407 
409 
410  $expected = [
411  [
412  'uid' => 'foobar',
413  'method' => 'REQUEST',
414  'component' => 'VEVENT',
415  'sender' => 'mailto:strunk@example.org',
416  'senderName' => 'Strunk',
417  'recipient' => 'mailto:one@example.org',
418  'recipientName' => 'One',
419  'message' => <<<ICS
420 BEGIN:VCALENDAR
421 VERSION:2.0
422 PRODID:-//Sabre//Sabre VObject $version//EN
423 CALSCALE:GREGORIAN
424 METHOD:REQUEST
425 BEGIN:VEVENT
426 UID:foobar
427 ORGANIZER;CN=Strunk:mailto:strunk@example.org
428 ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
429 DTSTART:20140716T120000Z
430 DTEND:20140716T130000Z
431 RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=8;BYDAY=SA,SU
432 END:VEVENT
433 END:VCALENDAR
434 ICS
435 
436  ],
437  ];
438 
439  $this->parse(null, $message, $expected, 'mailto:strunk@example.org');
440 
441  }
442 
444 
445  $message = <<<ICS
446 BEGIN:VCALENDAR
447 VERSION:2.0
448 BEGIN:VEVENT
449 UID:foobar
450 DTSTART:20140811T220000Z
451 DTEND:20140811T230000Z
452 ORGANIZER;CN=Strunk:mailto:strunk@example.org
453 ATTENDEE;CN=White;SCHEDULE-AGENT=CLIENT:mailto:white@example.org
454 END:VEVENT
455 END:VCALENDAR
456 ICS;
457 
459 
460  $this->parse(null, $message, [], 'mailto:strunk@example.org');
461 
462  }
463 
467  function testMultipleUID() {
468 
469  $message = <<<ICS
470 BEGIN:VCALENDAR
471 VERSION:2.0
472 BEGIN:VEVENT
473 UID:foobar
474 ORGANIZER;CN=Strunk:mailto:strunk@example.org
475 ATTENDEE;CN=One:mailto:one@example.org
476 ATTENDEE;CN=Two:mailto:two@example.org
477 DTSTART:20140716T120000Z
478 DTEND:20140716T130000Z
479 RRULE:FREQ=DAILY
480 END:VEVENT
481 BEGIN:VEVENT
482 UID:foobar2
483 RECURRENCE-ID:20140718T120000Z
484 ORGANIZER;CN=Strunk:mailto:strunk@example.org
485 ATTENDEE;CN=Two:mailto:two@example.org
486 ATTENDEE;CN=Three:mailto:three@example.org
487 DTSTART:20140718T120000Z
488 DTEND:20140718T130000Z
489 END:VEVENT
490 END:VCALENDAR
491 ICS;
492 
494  $this->parse(null, $message, [], 'mailto:strunk@example.org');
495 
496  }
497 
502 
503  $message = <<<ICS
504 BEGIN:VCALENDAR
505 VERSION:2.0
506 BEGIN:VEVENT
507 UID:foobar
508 ORGANIZER;CN=Strunk:mailto:strunk@example.org
509 ATTENDEE;CN=One:mailto:one@example.org
510 ATTENDEE;CN=Two:mailto:two@example.org
511 DTSTART:20140716T120000Z
512 DTEND:20140716T130000Z
513 RRULE:FREQ=DAILY
514 END:VEVENT
515 BEGIN:VEVENT
516 UID:foobar
517 RECURRENCE-ID:20140718T120000Z
518 ORGANIZER;CN=Strunk:mailto:ew@example.org
519 ATTENDEE;CN=Two:mailto:two@example.org
520 ATTENDEE;CN=Three:mailto:three@example.org
521 DTSTART:20140718T120000Z
522 DTEND:20140718T130000Z
523 END:VEVENT
524 END:VCALENDAR
525 ICS;
526 
528  $this->parse(null, $message, [], 'mailto:strunk@example.org');
529 
530  }
532 
533  $message = <<<ICS
534 BEGIN:VCALENDAR
535 BEGIN:VEVENT
536 UID:foobar
537 DTSTART:20140811T220000Z
538 DTEND:20140811T230000Z
539 ATTENDEE;CN=Two:mailto:two@example.org
540 END:VEVENT
541 END:VCALENDAR
542 ICS;
543 
544  $this->parse(null, $message, [], 'mailto:strunk@example.org');
545 
546  }
547 
548 }
$result
const VERSION
Full version number.
Definition: Version.php:17
$version
Definition: build.php:27
catch(Exception $e) $message
parse($oldMessage, $newMessage, $expected=[], $currentUser='mailto:one @example.org')
Utilities for testing the broker.