ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AvailableTest.php
Go to the documentation of this file.
1<?php
2
4
5use DateTimeImmutable;
6use DateTimeZone;
7use PHPUnit\Framework\TestCase;
9
14class AvailableTest extends TestCase {
15
17
18 $vcal = <<<VCAL
19BEGIN:VCALENDAR
20BEGIN:AVAILABLE
21END:AVAILABLE
22END:VCALENDAR
23VCAL;
24 $document = Reader::read($vcal);
25 $this->assertInstanceOf(__NAMESPACE__ . '\Available', $document->AVAILABLE);
26
27 }
28
30
31 $vcal = <<<VCAL
32BEGIN:VCALENDAR
33BEGIN:AVAILABLE
34DTSTART:20150717T162200Z
35DTEND:20150717T172200Z
36END:AVAILABLE
37END:VCALENDAR
38VCAL;
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
55BEGIN:VCALENDAR
56BEGIN:AVAILABLE
57DTSTART:20150717T162200Z
58DURATION:PT1H
59END:AVAILABLE
60END:VCALENDAR
61VCAL;
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}
An exception for terminatinating execution or to throw for unit testing.
We use RFCxxx has a placeholder for the https://tools.ietf.org/html/draft-daboo-calendar-availability...
iCalendar/vCard/jCal/jCard/xCal/xCard reader object.
Definition: Reader.php:15
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42