ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
VCalendarTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 
25 class VCalendarTest extends TestCase
26 {
27  public function testVCalendarRenderingWithoutEvents(): void
28  {
29  $expected_start = 'BEGIN:VCALENDAR' . "\r\n" .
30  'PRODID:-//ILIAS' . "\r\n" .
31  'VERSION:2.0' . "\r\n" .
32  "UID:unique identifier\r\n" .
33  "X-WR-RELCALID:unique identifier\r\n" .
34  "NAME:calendar name\r\n" .
35  "X-WR-CALNAME:calendar name\r\n";
36  // Timestamps in between which breaks the test because they are changing
37  $expected_end = 'METHOD:' . Method::PUBLISH->value . "\r\n" .
38  'BEGIN:VTIMEZONE' . "\r\n" .
39  'TZID:Europe/Paris' . "\r\n" .
40  'X-LIC-LOCATION:Europe/Paris' . "\r\n" .
41  'BEGIN:DAYLIGHT' . "\r\n" .
42  'TZOFFSETFROM:+0100' . "\r\n" .
43  'TZOFFSETTO:+0200' . "\r\n" .
44  'TZNAME:CEST' . "\r\n" .
45  'DTSTART:19700329T020000' . "\r\n" .
46  'RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU' . "\r\n" .
47  'END:DAYLIGHT' . "\r\n" .
48  'BEGIN:STANDARD' . "\r\n" .
49  'TZOFFSETFROM:+0200' . "\r\n" .
50  'TZOFFSETTO:+0100' . "\r\n" .
51  'TZNAME:CET' . "\r\n" .
52  'DTSTART:19701025T030000' . "\r\n" .
53  'RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU' . "\r\n" .
54  'END:STANDARD' . "\r\n" .
55  'END:VTIMEZONE' . "\r\n" .
56  'END:VCALENDAR' . "\r\n";
57 
58  $subject = new VCalendar(
59  Method::PUBLISH,
60  'calendar name',
61  'unique identifier'
62  );
63 
64  $result = $subject->render();
65 
66  $this->assertStringStartsWith($expected_start, $result);
67  $this->assertStringEndsWith($expected_end, $result);
68  }
69 }