Mercurial > hg > rc1
comparison vendor/sabre/vobject/tests/VObject/ITip/BrokerProcessReplyTest.php @ 7:430dbd5346f7
vendor sabre as distributed
author | Charlie Root |
---|---|
date | Sat, 13 Jan 2018 09:06:10 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:cec75ba50afc | 7:430dbd5346f7 |
---|---|
1 <?php | |
2 | |
3 namespace Sabre\VObject\ITip; | |
4 | |
5 class BrokerProcessReplyTest extends BrokerTester { | |
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 | |
72 function testReplyRequestStatus() { | |
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 | |
118 function testReplyPartyCrasher() { | |
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 | |
162 function testReplyNewException() { | |
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 ATTENDEE:mailto:foo@example.org | |
189 ORGANIZER:mailto:bar@example.org | |
190 END:VEVENT | |
191 END:VCALENDAR | |
192 ICS; | |
193 | |
194 $expected = <<<ICS | |
195 BEGIN:VCALENDAR | |
196 VERSION:2.0 | |
197 BEGIN:VEVENT | |
198 SEQUENCE:2 | |
199 UID:foobar | |
200 RRULE:FREQ=DAILY | |
201 DTSTART:20140724T000000Z | |
202 ATTENDEE:mailto:foo@example.org | |
203 ORGANIZER:mailto:bar@example.org | |
204 END:VEVENT | |
205 BEGIN:VEVENT | |
206 SEQUENCE:2 | |
207 UID:foobar | |
208 DTSTART:20140725T000000Z | |
209 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org | |
210 ORGANIZER:mailto:bar@example.org | |
211 RECURRENCE-ID:20140725T000000Z | |
212 END:VEVENT | |
213 END:VCALENDAR | |
214 ICS; | |
215 | |
216 $result = $this->process($itip, $old, $expected); | |
217 | |
218 } | |
219 | |
220 function testReplyNewExceptionTz() { | |
221 | |
222 // This is a reply to 1 instance of a recurring event. This should | |
223 // automatically create an exception. | |
224 $itip = <<<ICS | |
225 BEGIN:VCALENDAR | |
226 VERSION:2.0 | |
227 METHOD:REPLY | |
228 BEGIN:VEVENT | |
229 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org | |
230 ORGANIZER:mailto:bar@example.org | |
231 SEQUENCE:2 | |
232 RECURRENCE-ID;TZID=America/Toronto:20140725T000000 | |
233 UID:foobar | |
234 END:VEVENT | |
235 END:VCALENDAR | |
236 ICS; | |
237 | |
238 $old = <<<ICS | |
239 BEGIN:VCALENDAR | |
240 VERSION:2.0 | |
241 BEGIN:VEVENT | |
242 SEQUENCE:2 | |
243 UID:foobar | |
244 RRULE:FREQ=DAILY | |
245 DTSTART;TZID=America/Toronto:20140724T000000 | |
246 ATTENDEE:mailto:foo@example.org | |
247 ORGANIZER:mailto:bar@example.org | |
248 END:VEVENT | |
249 END:VCALENDAR | |
250 ICS; | |
251 | |
252 $expected = <<<ICS | |
253 BEGIN:VCALENDAR | |
254 VERSION:2.0 | |
255 BEGIN:VEVENT | |
256 SEQUENCE:2 | |
257 UID:foobar | |
258 RRULE:FREQ=DAILY | |
259 DTSTART;TZID=America/Toronto:20140724T000000 | |
260 ATTENDEE:mailto:foo@example.org | |
261 ORGANIZER:mailto:bar@example.org | |
262 END:VEVENT | |
263 BEGIN:VEVENT | |
264 SEQUENCE:2 | |
265 UID:foobar | |
266 DTSTART;TZID=America/Toronto:20140725T000000 | |
267 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org | |
268 ORGANIZER:mailto:bar@example.org | |
269 RECURRENCE-ID;TZID=America/Toronto:20140725T000000 | |
270 END:VEVENT | |
271 END:VCALENDAR | |
272 ICS; | |
273 | |
274 $result = $this->process($itip, $old, $expected); | |
275 | |
276 } | |
277 | |
278 function testReplyPartyCrashCreateExcepton() { | |
279 | |
280 // IN this test there's a recurring event that has an exception. The | |
281 // exception is missing the attendee. | |
282 // | |
283 // The attendee party crashes the instance, so it should show up in the | |
284 // resulting object. | |
285 $itip = <<<ICS | |
286 BEGIN:VCALENDAR | |
287 VERSION:2.0 | |
288 METHOD:REPLY | |
289 BEGIN:VEVENT | |
290 ATTENDEE;PARTSTAT=ACCEPTED;CN=Crasher!:mailto:crasher@example.org | |
291 ORGANIZER:mailto:bar@example.org | |
292 SEQUENCE:2 | |
293 RECURRENCE-ID:20140725T000000Z | |
294 UID:foobar | |
295 END:VEVENT | |
296 END:VCALENDAR | |
297 ICS; | |
298 | |
299 $old = <<<ICS | |
300 BEGIN:VCALENDAR | |
301 VERSION:2.0 | |
302 BEGIN:VEVENT | |
303 SEQUENCE:2 | |
304 UID:foobar | |
305 RRULE:FREQ=DAILY | |
306 DTSTART:20140724T000000Z | |
307 ORGANIZER:mailto:bar@example.org | |
308 END:VEVENT | |
309 END:VCALENDAR | |
310 ICS; | |
311 | |
312 $expected = <<<ICS | |
313 BEGIN:VCALENDAR | |
314 VERSION:2.0 | |
315 BEGIN:VEVENT | |
316 SEQUENCE:2 | |
317 UID:foobar | |
318 RRULE:FREQ=DAILY | |
319 DTSTART:20140724T000000Z | |
320 ORGANIZER:mailto:bar@example.org | |
321 END:VEVENT | |
322 BEGIN:VEVENT | |
323 SEQUENCE:2 | |
324 UID:foobar | |
325 DTSTART:20140725T000000Z | |
326 ORGANIZER:mailto:bar@example.org | |
327 RECURRENCE-ID:20140725T000000Z | |
328 ATTENDEE;PARTSTAT=ACCEPTED;CN=Crasher!:mailto:crasher@example.org | |
329 END:VEVENT | |
330 END:VCALENDAR | |
331 ICS; | |
332 | |
333 $result = $this->process($itip, $old, $expected); | |
334 | |
335 } | |
336 | |
337 function testReplyNewExceptionNoMasterEvent() { | |
338 | |
339 /** | |
340 * This iTip message would normally create a new exception, but the | |
341 * server is not able to create this new instance, because there's no | |
342 * master event to clone from. | |
343 * | |
344 * This test checks if the message is ignored. | |
345 */ | |
346 $itip = <<<ICS | |
347 BEGIN:VCALENDAR | |
348 VERSION:2.0 | |
349 METHOD:REPLY | |
350 BEGIN:VEVENT | |
351 ATTENDEE;PARTSTAT=ACCEPTED;CN=Crasher!:mailto:crasher@example.org | |
352 ORGANIZER:mailto:bar@example.org | |
353 SEQUENCE:2 | |
354 RECURRENCE-ID:20140725T000000Z | |
355 UID:foobar | |
356 END:VEVENT | |
357 END:VCALENDAR | |
358 ICS; | |
359 | |
360 $old = <<<ICS | |
361 BEGIN:VCALENDAR | |
362 VERSION:2.0 | |
363 BEGIN:VEVENT | |
364 SEQUENCE:2 | |
365 UID:foobar | |
366 RRULE:FREQ=DAILY | |
367 DTSTART:20140724T000000Z | |
368 RECURRENCE-ID:20140724T000000Z | |
369 ORGANIZER:mailto:bar@example.org | |
370 END:VEVENT | |
371 END:VCALENDAR | |
372 ICS; | |
373 | |
374 $expected = null; | |
375 $result = $this->process($itip, $old, $expected); | |
376 | |
377 } | |
378 | |
379 /** | |
380 * @depends testReplyAccept | |
381 */ | |
382 function testReplyAcceptUpdateRSVP() { | |
383 | |
384 $itip = <<<ICS | |
385 BEGIN:VCALENDAR | |
386 VERSION:2.0 | |
387 METHOD:REPLY | |
388 BEGIN:VEVENT | |
389 ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo@example.org | |
390 ORGANIZER:mailto:bar@example.org | |
391 SEQUENCE:2 | |
392 UID:foobar | |
393 END:VEVENT | |
394 END:VCALENDAR | |
395 ICS; | |
396 | |
397 $old = <<<ICS | |
398 BEGIN:VCALENDAR | |
399 VERSION:2.0 | |
400 BEGIN:VEVENT | |
401 SEQUENCE:2 | |
402 UID:foobar | |
403 ATTENDEE;RSVP=TRUE:mailto:foo@example.org | |
404 ORGANIZER:mailto:bar@example.org | |
405 END:VEVENT | |
406 END:VCALENDAR | |
407 ICS; | |
408 | |
409 $expected = <<<ICS | |
410 BEGIN:VCALENDAR | |
411 VERSION:2.0 | |
412 BEGIN:VEVENT | |
413 SEQUENCE:2 | |
414 UID:foobar | |
415 ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:foo@example.org | |
416 ORGANIZER:mailto:bar@example.org | |
417 END:VEVENT | |
418 END:VCALENDAR | |
419 ICS; | |
420 | |
421 $result = $this->process($itip, $old, $expected); | |
422 | |
423 } | |
424 | |
425 } |