ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
OverrideFirstEventTest.php
Go to the documentation of this file.
1<?php
2
4
5use DateTime;
6use PHPUnit\Framework\TestCase;
8
9class OverrideFirstEventTest extends TestCase {
10
11 use \Sabre\VObject\PHPUnitAssertions;
12
14
15 $input = <<<ICS
16BEGIN:VCALENDAR
17VERSION:2.0
18BEGIN:VEVENT
19UID:foobar
20DTSTART:20140803T120000Z
21RRULE:FREQ=WEEKLY
22SUMMARY:Original
23END:VEVENT
24BEGIN:VEVENT
25UID:foobar
26RECURRENCE-ID:20140803T120000Z
27DTSTART:20140803T120000Z
28SUMMARY:Overridden
29END:VEVENT
30END:VCALENDAR
31ICS;
32
34 $vcal = $vcal->expand(new DateTime('2014-08-01'), new DateTime('2014-09-01'));
35
36 $expected = <<<ICS
37BEGIN:VCALENDAR
38VERSION:2.0
39BEGIN:VEVENT
40UID:foobar
41RECURRENCE-ID:20140803T120000Z
42DTSTART:20140803T120000Z
43SUMMARY:Overridden
44END:VEVENT
45BEGIN:VEVENT
46UID:foobar
47DTSTART:20140810T120000Z
48SUMMARY:Original
49RECURRENCE-ID:20140810T120000Z
50END:VEVENT
51BEGIN:VEVENT
52UID:foobar
53DTSTART:20140817T120000Z
54SUMMARY:Original
55RECURRENCE-ID:20140817T120000Z
56END:VEVENT
57BEGIN:VEVENT
58UID:foobar
59DTSTART:20140824T120000Z
60SUMMARY:Original
61RECURRENCE-ID:20140824T120000Z
62END:VEVENT
63BEGIN:VEVENT
64UID:foobar
65DTSTART:20140831T120000Z
66SUMMARY:Original
67RECURRENCE-ID:20140831T120000Z
68END:VEVENT
69END:VCALENDAR
70ICS;
71
72 $this->assertVObjectEqualsVObject(
73 $expected,
74 $vcal
75 );
76
77
78 }
79
81
82 $input = <<<ICS
83BEGIN:VCALENDAR
84VERSION:2.0
85BEGIN:VEVENT
86UID:foobar
87DTSTART:20140803T120000Z
88RRULE:FREQ=WEEKLY
89EXDATE:20140803T120000Z
90SUMMARY:Original
91END:VEVENT
92END:VCALENDAR
93ICS;
94
96 $vcal = $vcal->expand(new DateTime('2014-08-01'), new DateTime('2014-08-19'));
97
98 $expected = <<<ICS
99BEGIN:VCALENDAR
100VERSION:2.0
101BEGIN:VEVENT
102UID:foobar
103DTSTART:20140810T120000Z
104SUMMARY:Original
105RECURRENCE-ID:20140810T120000Z
106END:VEVENT
107BEGIN:VEVENT
108UID:foobar
109DTSTART:20140817T120000Z
110SUMMARY:Original
111RECURRENCE-ID:20140817T120000Z
112END:VEVENT
113END:VCALENDAR
114ICS;
115
116 $this->assertVObjectEqualsVObject(
117 $expected,
118 $vcal
119 );
120
121 }
122}
An exception for terminatinating execution or to throw for unit testing.
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
foreach($paths as $path) if($argc< 3) $input