ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AvailableTest.php
Go to the documentation of this file.
1 <?php
2 
4 
6 use DateTimeZone;
9 
14 class AvailableTest extends TestCase {
15 
17 
18  $vcal = <<<VCAL
19 BEGIN:VCALENDAR
20 BEGIN:AVAILABLE
21 END:AVAILABLE
22 END:VCALENDAR
23 VCAL;
24  $document = Reader::read($vcal);
25  $this->assertInstanceOf(__NAMESPACE__ . '\Available', $document->AVAILABLE);
26 
27  }
28 
30 
31  $vcal = <<<VCAL
32 BEGIN:VCALENDAR
33 BEGIN:AVAILABLE
34 DTSTART:20150717T162200Z
35 DTEND:20150717T172200Z
36 END:AVAILABLE
37 END:VCALENDAR
38 VCAL;
39 
40  $document = Reader::read($vcal);
41  $tz = new DateTimeZone('UTC');
42  $this->assertEquals(
43  [
44  new DateTimeImmutable('2015-07-17 16:22:00', $tz),
45  new DateTimeImmutable('2015-07-17 17:22:00', $tz),
46  ],
47  $document->AVAILABLE->getEffectiveStartEnd()
48  );
49 
50  }
51 
53 
54  $vcal = <<<VCAL
55 BEGIN:VCALENDAR
56 BEGIN:AVAILABLE
57 DTSTART:20150717T162200Z
58 DURATION:PT1H
59 END:AVAILABLE
60 END:VCALENDAR
61 VCAL;
62 
63  $document = Reader::read($vcal);
64  $tz = new DateTimeZone('UTC');
65  $this->assertEquals(
66  [
67  new DateTimeImmutable('2015-07-17 16:22:00', $tz),
68  new DateTimeImmutable('2015-07-17 17:22:00', $tz),
69  ],
70  $document->AVAILABLE->getEffectiveStartEnd()
71  );
72 
73  }
74 }
We use RFCxxx has a placeholder for the https://tools.ietf.org/html/draft-daboo-calendar-availability...
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42