ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\BirthdayCalendarGeneratorTest Class Reference
+ Inheritance diagram for Sabre\VObject\BirthdayCalendarGeneratorTest:
+ Collaboration diagram for Sabre\VObject\BirthdayCalendarGeneratorTest:

Public Member Functions

 testVcardStringWithValidBirthday ()
 
 testArrayOfVcardStringsWithValidBirthdays ()
 
 testArrayOfVcardStringsWithValidBirthdaysViaConstructor ()
 
 testVcardObjectWithValidBirthday ()
 
 testArrayOfVcardObjectsWithValidBirthdays ()
 
 testVcardStringWithValidBirthdayWithXAppleOmitYear ()
 
 testVcardStringWithValidBirthdayWithoutYear ()
 
 testVcardStringWithInvalidBirthday ()
 
 testVcardStringWithNoBirthday ()
 
 testVcardStringWithValidBirthdayLocalized ()
 
 testVcardStringWithEmptyBirthdayProperty ()
 
 testParseException ()
 
 testInvalidArgumentException ()
 
 testInvalidArgumentExceptionForPartiallyInvalidArray ()
 
 testBrokenVcardWithoutFN ()
 

Detailed Description

Definition at line 7 of file BirthdayCalendarGeneratorTest.php.

Member Function Documentation

◆ testArrayOfVcardObjectsWithValidBirthdays()

Sabre\VObject\BirthdayCalendarGeneratorTest::testArrayOfVcardObjectsWithValidBirthdays ( )

Definition at line 208 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input, $key, Sabre\VObject\$output, and Sabre\VObject\Reader\read().

208  {
209 
210  $generator = new BirthdayCalendarGenerator();
211  $input = [];
212 
213  $input[] = <<<VCF
214 BEGIN:VCARD
215 VERSION:3.0
216 N:Gump;Forrest;;Mr.
217 FN:Forrest Gump
218 BDAY:19850407
219 UID:foo
220 END:VCARD
221 VCF;
222 
223  $input[] = <<<VCF
224 BEGIN:VCARD
225 VERSION:3.0
226 N:Doe;John;;Mr.
227 FN:John Doe
228 BDAY:19820210
229 UID:bar
230 END:VCARD
231 VCF;
232 
233  foreach ($input as $key => $value) {
234  $input[$key] = Reader::read($value);
235  }
236 
237  $expected = <<<ICS
238 BEGIN:VCALENDAR
239 VERSION:2.0
240 BEGIN:VEVENT
241 UID:**ANY**
242 DTSTAMP:**ANY**
243 SUMMARY:Forrest Gump's Birthday
244 DTSTART;VALUE=DATE:19850407
245 RRULE:FREQ=YEARLY
246 TRANSP:TRANSPARENT
247 X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
248 END:VEVENT
249 BEGIN:VEVENT
250 UID:**ANY**
251 DTSTAMP:**ANY**
252 SUMMARY:John Doe's Birthday
253 DTSTART;VALUE=DATE:19820210
254 RRULE:FREQ=YEARLY
255 TRANSP:TRANSPARENT
256 X-SABRE-BDAY;X-SABRE-VCARD-UID=bar;X-SABRE-VCARD-FN=John Doe:BDAY
257 END:VEVENT
258 END:VCALENDAR
259 ICS;
260 
261  $generator->setObjects($input);
262  $output = $generator->getResult();
263 
264  $this->assertVObjectEqualsVObject(
265  $expected,
266  $output
267  );
268 
269  }
if($argc< 3) $input
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ testArrayOfVcardStringsWithValidBirthdays()

Sabre\VObject\BirthdayCalendarGeneratorTest::testArrayOfVcardStringsWithValidBirthdays ( )

Definition at line 49 of file BirthdayCalendarGeneratorTest.php.

49  {
50 
51  $generator = new BirthdayCalendarGenerator();
52  $input = [];
53 
54  $input[] = <<<VCF
55 BEGIN:VCARD
56 VERSION:3.0
57 N:Gump;Forrest;;Mr.
58 FN:Forrest Gump
59 BDAY:19850407
60 UID:foo
61 END:VCARD
62 VCF;
63 
64  $input[] = <<<VCF
65 BEGIN:VCARD
66 VERSION:3.0
67 N:Doe;John;;Mr.
68 FN:John Doe
69 BDAY:19820210
70 UID:bar
71 END:VCARD
72 VCF;
73 
74  $expected = <<<ICS
75 BEGIN:VCALENDAR
76 VERSION:2.0
77 BEGIN:VEVENT
78 UID:**ANY**
79 DTSTAMP:**ANY**
80 SUMMARY:Forrest Gump's Birthday
81 DTSTART;VALUE=DATE:19850407
82 RRULE:FREQ=YEARLY
83 TRANSP:TRANSPARENT
84 X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
85 END:VEVENT
86 BEGIN:VEVENT
87 UID:**ANY**
88 DTSTAMP:**ANY**
89 SUMMARY:John Doe's Birthday
90 DTSTART;VALUE=DATE:19820210
91 RRULE:FREQ=YEARLY
92 TRANSP:TRANSPARENT
93 X-SABRE-BDAY;X-SABRE-VCARD-UID=bar;X-SABRE-VCARD-FN=John Doe:BDAY
94 END:VEVENT
95 END:VCALENDAR
96 ICS;
97 
98  $generator->setObjects($input);
99  $output = $generator->getResult();
100 
101  $this->assertVObjectEqualsVObject(
102  $expected,
103  $output
104  );
105 
106  }
if($argc< 3) $input

◆ testArrayOfVcardStringsWithValidBirthdaysViaConstructor()

Sabre\VObject\BirthdayCalendarGeneratorTest::testArrayOfVcardStringsWithValidBirthdaysViaConstructor ( )

Definition at line 108 of file BirthdayCalendarGeneratorTest.php.

108  {
109 
110  $input = [];
111 
112  $input[] = <<<VCF
113 BEGIN:VCARD
114 VERSION:3.0
115 N:Gump;Forrest;;Mr.
116 FN:Forrest Gump
117 BDAY:19850407
118 UID:foo
119 END:VCARD
120 VCF;
121 
122  $input[] = <<<VCF
123 BEGIN:VCARD
124 VERSION:3.0
125 N:Doe;John;;Mr.
126 FN:John Doe
127 BDAY:19820210
128 UID:bar
129 END:VCARD
130 VCF;
131 
132  $generator = new BirthdayCalendarGenerator($input);
133 
134  $expected = <<<ICS
135 BEGIN:VCALENDAR
136 VERSION:2.0
137 BEGIN:VEVENT
138 UID:**ANY**
139 DTSTAMP:**ANY**
140 SUMMARY:Forrest Gump's Birthday
141 DTSTART;VALUE=DATE:19850407
142 RRULE:FREQ=YEARLY
143 TRANSP:TRANSPARENT
144 X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
145 END:VEVENT
146 BEGIN:VEVENT
147 UID:**ANY**
148 DTSTAMP:**ANY**
149 SUMMARY:John Doe's Birthday
150 DTSTART;VALUE=DATE:19820210
151 RRULE:FREQ=YEARLY
152 TRANSP:TRANSPARENT
153 X-SABRE-BDAY;X-SABRE-VCARD-UID=bar;X-SABRE-VCARD-FN=John Doe:BDAY
154 END:VEVENT
155 END:VCALENDAR
156 ICS;
157 
158  $generator->setObjects($input);
159  $output = $generator->getResult();
160 
161  $this->assertVObjectEqualsVObject(
162  $expected,
163  $output
164  );
165 
166  }
if($argc< 3) $input

◆ testBrokenVcardWithoutFN()

Sabre\VObject\BirthdayCalendarGeneratorTest::testBrokenVcardWithoutFN ( )

Definition at line 536 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input, and Sabre\VObject\$output.

536  {
537 
538  $generator = new BirthdayCalendarGenerator();
539  $input = <<<VCF
540 BEGIN:VCARD
541 VERSION:3.0
542 N:Gump;Forrest;;Mr.
543 BDAY:19850407
544 UID:foo
545 END:VCARD
546 VCF;
547 
548  $expected = <<<ICS
549 BEGIN:VCALENDAR
550 VERSION:2.0
551 END:VCALENDAR
552 ICS;
553 
554  $generator->setObjects($input);
555  $output = $generator->getResult();
556 
557  $this->assertVObjectEqualsVObject(
558  $expected,
559  $output
560  );
561 
562  }
if($argc< 3) $input

◆ testInvalidArgumentException()

Sabre\VObject\BirthdayCalendarGeneratorTest::testInvalidArgumentException ( )

Definition at line 491 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input.

491  {
492 
493  $generator = new BirthdayCalendarGenerator();
494  $input = <<<ICS
495 BEGIN:VCALENDAR
496 VERSION:2.0
497 BEGIN:VEVENT
498 SUMMARY:Foo
499 DTSTART;VALUE=DATE:19850407
500 END:VEVENT
501 END:VCALENDAR
502 ICS;
503 
504  $generator->setObjects($input);
505 
506  }
if($argc< 3) $input

◆ testInvalidArgumentExceptionForPartiallyInvalidArray()

Sabre\VObject\BirthdayCalendarGeneratorTest::testInvalidArgumentExceptionForPartiallyInvalidArray ( )

Definition at line 511 of file BirthdayCalendarGeneratorTest.php.

References $calendar, and Sabre\VObject\$input.

511  {
512 
513  $generator = new BirthdayCalendarGenerator();
514  $input = [];
515 
516  $input[] = <<<VCF
517 BEGIN:VCARD
518 VERSION:3.0
519 N:Gump;Forrest;;Mr.
520 FN:Forrest Gump
521 BDAY:19850407
522 UID:foo
523 END:VCARD
524 VCF;
525  $calendar = new Component\VCalendar();
526 
527  $input = $calendar->add('VEVENT', [
528  'SUMMARY' => 'Foo',
529  'DTSTART' => new \DateTime('NOW'),
530  ]);
531 
532  $generator->setObjects($input);
533 
534  }
if($argc< 3) $input

◆ testParseException()

Sabre\VObject\BirthdayCalendarGeneratorTest::testParseException ( )

Definition at line 475 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input.

475  {
476 
477  $generator = new BirthdayCalendarGenerator();
478  $input = <<<FOO
479 BEGIN:FOO
480 FOO:Bar
481 END:FOO
482 FOO;
483 
484  $generator->setObjects($input);
485 
486  }
if($argc< 3) $input

◆ testVcardObjectWithValidBirthday()

Sabre\VObject\BirthdayCalendarGeneratorTest::testVcardObjectWithValidBirthday ( )

Definition at line 168 of file BirthdayCalendarGeneratorTest.php.

168  {
169 
170  $generator = new BirthdayCalendarGenerator();
171  $input = <<<VCF
172 BEGIN:VCARD
173 VERSION:3.0
174 N:Gump;Forrest;;Mr.
175 FN:Forrest Gump
176 BDAY:19850407
177 UID:foo
178 END:VCARD
179 VCF;
180 
182 
183  $expected = <<<ICS
184 BEGIN:VCALENDAR
185 VERSION:2.0
186 BEGIN:VEVENT
187 UID:**ANY**
188 DTSTAMP:**ANY**
189 SUMMARY:Forrest Gump's Birthday
190 DTSTART;VALUE=DATE:19850407
191 RRULE:FREQ=YEARLY
192 TRANSP:TRANSPARENT
193 X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
194 END:VEVENT
195 END:VCALENDAR
196 ICS;
197 
198  $generator->setObjects($input);
199  $output = $generator->getResult();
200 
201  $this->assertVObjectEqualsVObject(
202  $expected,
203  $output
204  );
205 
206  }
if($argc< 3) $input
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42

◆ testVcardStringWithEmptyBirthdayProperty()

Sabre\VObject\BirthdayCalendarGeneratorTest::testVcardStringWithEmptyBirthdayProperty ( )

Definition at line 443 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input, and Sabre\VObject\$output.

443  {
444 
445  $generator = new BirthdayCalendarGenerator();
446  $input = <<<VCF
447 BEGIN:VCARD
448 VERSION:3.0
449 N:Gump;Forrest;;Mr.
450 FN:Forrest Gump
451 BDAY:
452 UID:foo
453 END:VCARD
454 VCF;
455 
456  $expected = <<<ICS
457 BEGIN:VCALENDAR
458 VERSION:2.0
459 END:VCALENDAR
460 ICS;
461 
462  $generator->setObjects($input);
463  $output = $generator->getResult();
464 
465  $this->assertVObjectEqualsVObject(
466  $expected,
467  $output
468  );
469 
470  }
if($argc< 3) $input

◆ testVcardStringWithInvalidBirthday()

Sabre\VObject\BirthdayCalendarGeneratorTest::testVcardStringWithInvalidBirthday ( )

Definition at line 347 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input, and Sabre\VObject\$output.

347  {
348 
349  $generator = new BirthdayCalendarGenerator();
350  $input = <<<VCF
351 BEGIN:VCARD
352 VERSION:3.0
353 N:Gump;Forrest;;Mr.
354 FN:Forrest Gump
355 BDAY:foo
356 X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
357 END:VCARD
358 VCF;
359 
360  $expected = <<<ICS
361 BEGIN:VCALENDAR
362 VERSION:2.0
363 END:VCALENDAR
364 ICS;
365 
366  $generator->setObjects($input);
367  $output = $generator->getResult();
368 
369  $this->assertVObjectEqualsVObject(
370  $expected,
371  $output
372  );
373 
374  }
if($argc< 3) $input

◆ testVcardStringWithNoBirthday()

Sabre\VObject\BirthdayCalendarGeneratorTest::testVcardStringWithNoBirthday ( )

Definition at line 376 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input, and Sabre\VObject\$output.

376  {
377 
378  $generator = new BirthdayCalendarGenerator();
379  $input = <<<VCF
380 BEGIN:VCARD
381 VERSION:3.0
382 N:Gump;Forrest;;Mr.
383 FN:Forrest Gump
384 UID:foo
385 END:VCARD
386 VCF;
387 
388  $expected = <<<ICS
389 BEGIN:VCALENDAR
390 VERSION:2.0
391 END:VCALENDAR
392 ICS;
393 
394  $generator->setObjects($input);
395  $output = $generator->getResult();
396 
397  $this->assertVObjectEqualsVObject(
398  $expected,
399  $output
400  );
401 
402  }
if($argc< 3) $input

◆ testVcardStringWithValidBirthday()

Sabre\VObject\BirthdayCalendarGeneratorTest::testVcardStringWithValidBirthday ( )

Definition at line 11 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input.

11  {
12 
13  $generator = new BirthdayCalendarGenerator();
14  $input = <<<VCF
15 BEGIN:VCARD
16 VERSION:3.0
17 N:Gump;Forrest;;Mr.
18 FN:Forrest Gump
19 BDAY:19850407
20 UID:foo
21 END:VCARD
22 VCF;
23 
24  $expected = <<<ICS
25 BEGIN:VCALENDAR
26 VERSION:2.0
27 BEGIN:VEVENT
28 UID:**ANY**
29 DTSTAMP:**ANY**
30 SUMMARY:Forrest Gump's Birthday
31 DTSTART;VALUE=DATE:19850407
32 RRULE:FREQ=YEARLY
33 TRANSP:TRANSPARENT
34 X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
35 END:VEVENT
36 END:VCALENDAR
37 ICS;
38 
39  $generator->setObjects($input);
40  $output = $generator->getResult();
41 
42  $this->assertVObjectEqualsVObject(
43  $expected,
44  $output
45  );
46 
47  }
if($argc< 3) $input

◆ testVcardStringWithValidBirthdayLocalized()

Sabre\VObject\BirthdayCalendarGeneratorTest::testVcardStringWithValidBirthdayLocalized ( )

Definition at line 404 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input, Sabre\VObject\$output, and $s.

404  {
405 
406  $generator = new BirthdayCalendarGenerator();
407  $input = <<<VCF
408 BEGIN:VCARD
409 VERSION:3.0
410 N:Gump;Forrest;;Mr.
411 FN:Forrest Gump
412 BDAY:19850407
413 UID:foo
414 END:VCARD
415 VCF;
416 
417  $expected = <<<ICS
418 BEGIN:VCALENDAR
419 VERSION:2.0
420 BEGIN:VEVENT
421 UID:**ANY**
422 DTSTAMP:**ANY**
423 SUMMARY:Forrest Gump's Geburtstag
424 DTSTART;VALUE=DATE:19850407
425 RRULE:FREQ=YEARLY
426 TRANSP:TRANSPARENT
427 X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
428 END:VEVENT
429 END:VCALENDAR
430 ICS;
431 
432  $generator->setObjects($input);
433  $generator->setFormat('%1$s\'s Geburtstag');
434  $output = $generator->getResult();
435 
436  $this->assertVObjectEqualsVObject(
437  $expected,
438  $output
439  );
440 
441  }
if($argc< 3) $input
$s
Definition: pwgen.php:45

◆ testVcardStringWithValidBirthdayWithoutYear()

Sabre\VObject\BirthdayCalendarGeneratorTest::testVcardStringWithValidBirthdayWithoutYear ( )

Definition at line 309 of file BirthdayCalendarGeneratorTest.php.

309  {
310 
311  $generator = new BirthdayCalendarGenerator();
312  $input = <<<VCF
313 BEGIN:VCARD
314 VERSION:4.0
315 N:Gump;Forrest;;Mr.
316 FN:Forrest Gump
317 BDAY:--04-07
318 UID:foo
319 END:VCARD
320 VCF;
321 
322  $expected = <<<ICS
323 BEGIN:VCALENDAR
324 VERSION:2.0
325 BEGIN:VEVENT
326 UID:**ANY**
327 DTSTAMP:**ANY**
328 SUMMARY:Forrest Gump's Birthday
329 DTSTART;VALUE=DATE:20000407
330 RRULE:FREQ=YEARLY
331 TRANSP:TRANSPARENT
332 X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump;X-SABRE-OMIT-YEAR=2000:BDAY
333 END:VEVENT
334 END:VCALENDAR
335 ICS;
336 
337  $generator->setObjects($input);
338  $output = $generator->getResult();
339 
340  $this->assertVObjectEqualsVObject(
341  $expected,
342  $output
343  );
344 
345  }
if($argc< 3) $input

◆ testVcardStringWithValidBirthdayWithXAppleOmitYear()

Sabre\VObject\BirthdayCalendarGeneratorTest::testVcardStringWithValidBirthdayWithXAppleOmitYear ( )

Definition at line 271 of file BirthdayCalendarGeneratorTest.php.

References Sabre\VObject\$input.

271  {
272 
273  $generator = new BirthdayCalendarGenerator();
274  $input = <<<VCF
275 BEGIN:VCARD
276 VERSION:3.0
277 N:Gump;Forrest;;Mr.
278 FN:Forrest Gump
279 BDAY;X-APPLE-OMIT-YEAR=1604:1604-04-07
280 UID:foo
281 END:VCARD
282 VCF;
283 
284  $expected = <<<ICS
285 BEGIN:VCALENDAR
286 VERSION:2.0
287 BEGIN:VEVENT
288 UID:**ANY**
289 DTSTAMP:**ANY**
290 SUMMARY:Forrest Gump's Birthday
291 DTSTART;VALUE=DATE:20000407
292 RRULE:FREQ=YEARLY
293 TRANSP:TRANSPARENT
294 X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump;X-SABRE-OMIT-YEAR=2000:BDAY
295 END:VEVENT
296 END:VCALENDAR
297 ICS;
298 
299  $generator->setObjects($input);
300  $output = $generator->getResult();
301 
302  $this->assertVObjectEqualsVObject(
303  $expected,
304  $output
305  );
306 
307  }
if($argc< 3) $input

The documentation for this class was generated from the following file: