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

Public Member Functions

 setUp ()
 
 createStream ($data)
 
 testICalendarImportValidEvent ()
 
 testICalendarImportWrongType ()
 @expectedException Sabre\VObject\ParseException More...
 
 testICalendarImportEndOfData ()
 
 testICalendarImportInvalidEvent ()
 @expectedException Sabre\VObject\ParseException More...
 
 testICalendarImportMultipleValidEvents ()
 
 testICalendarImportEventWithoutUID ()
 
 testICalendarImportMultipleVTIMEZONESAndMultipleValidEvents ()
 
 testICalendarImportWithOutVTIMEZONES ()
 

Protected Attributes

 $version
 

Detailed Description

Definition at line 8 of file ICalendarTest.php.

Member Function Documentation

◆ createStream()

◆ setUp()

Sabre\VObject\Splitter\ICalendarTest::setUp ( )

Definition at line 12 of file ICalendarTest.php.

12 {
13 $this->version = VObject\Version::VERSION;
14 }
const VERSION
Full version number.
Definition: Version.php:17

References Sabre\VObject\Version\VERSION.

◆ testICalendarImportEndOfData()

Sabre\VObject\Splitter\ICalendarTest::testICalendarImportEndOfData ( )

Definition at line 66 of file ICalendarTest.php.

66 {
67 $data = <<<EOT
68BEGIN:VCALENDAR
69BEGIN:VEVENT
70UID:foo
71DTSTAMP:20140122T233226Z
72END:VEVENT
73END:VCALENDAR
74EOT;
75 $tempFile = $this->createStream($data);
76
77 $objects = new ICalendar($tempFile);
78
79 $return = "";
80 while ($object = $objects->getNext()) {
81 $return .= $object->serialize();
82 }
83 $this->assertNull($object = $objects->getNext());
84 }

References $data, and Sabre\VObject\Splitter\ICalendarTest\createStream().

+ Here is the call graph for this function:

◆ testICalendarImportEventWithoutUID()

Sabre\VObject\Splitter\ICalendarTest::testICalendarImportEventWithoutUID ( )

Definition at line 148 of file ICalendarTest.php.

148 {
149
150 $data = <<<EOT
151BEGIN:VCALENDAR
152VERSION:2.0
153PRODID:-//Sabre//Sabre VObject $this->version//EN
154CALSCALE:GREGORIAN
155BEGIN:VEVENT
156DTSTART:20140101T040000Z
157DTSTAMP:20140122T233226Z
158END:VEVENT
159END:VCALENDAR
160
161EOT;
162 $tempFile = $this->createStream($data);
163
164 $objects = new ICalendar($tempFile);
165
166 $return = "";
167 while ($object = $objects->getNext()) {
168 $return .= $object->serialize();
169 }
170
171 $messages = VObject\Reader::read($return)->validate();
172
173 if ($messages) {
174 $messages = array_map(
175 function($item) { return $item['message']; },
177 );
178 $this->fail('Validation errors: ' . implode("\n", $messages));
179 } else {
180 $this->assertEquals([], $messages);
181 }
182 }
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
$messages
Definition: en.php:5

References $data, $messages, Sabre\VObject\Splitter\ICalendarTest\createStream(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testICalendarImportInvalidEvent()

Sabre\VObject\Splitter\ICalendarTest::testICalendarImportInvalidEvent ( )

@expectedException Sabre\VObject\ParseException

Definition at line 89 of file ICalendarTest.php.

89 {
90 $data = <<<EOT
91EOT;
92 $tempFile = $this->createStream($data);
93 $objects = new ICalendar($tempFile);
94
95 }

References $data, and Sabre\VObject\Splitter\ICalendarTest\createStream().

+ Here is the call graph for this function:

◆ testICalendarImportMultipleValidEvents()

Sabre\VObject\Splitter\ICalendarTest::testICalendarImportMultipleValidEvents ( )

Definition at line 97 of file ICalendarTest.php.

97 {
98
99 $event[] = <<<EOT
100BEGIN:VEVENT
101UID:foo1
102DTSTAMP:20140122T233226Z
103DTSTART:20140101T050000Z
104END:VEVENT
105EOT;
106
107$event[] = <<<EOT
108BEGIN:VEVENT
109UID:foo2
110DTSTAMP:20140122T233226Z
111DTSTART:20140101T060000Z
112END:VEVENT
113EOT;
114
115 $data = <<<EOT
116BEGIN:VCALENDAR
117$event[0]
118$event[1]
119END:VCALENDAR
120
121EOT;
122 $tempFile = $this->createStream($data);
123
124 $objects = new ICalendar($tempFile);
125
126 $return = "";
127 $i = 0;
128 while ($object = $objects->getNext()) {
129
130 $expected = <<<EOT
131BEGIN:VCALENDAR
132VERSION:2.0
133PRODID:-//Sabre//Sabre VObject $this->version//EN
134CALSCALE:GREGORIAN
135$event[$i]
136END:VCALENDAR
137
138EOT;
139
140 $return .= $object->serialize();
141 $expected = str_replace("\n", "\r\n", $expected);
142 $this->assertEquals($expected, $object->serialize());
143 $i++;
144 }
145 $this->assertEquals([], VObject\Reader::read($return)->validate());
146 }
$i
Definition: disco.tpl.php:19

References $data, $i, Sabre\VObject\Splitter\ICalendarTest\createStream(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testICalendarImportMultipleVTIMEZONESAndMultipleValidEvents()

Sabre\VObject\Splitter\ICalendarTest::testICalendarImportMultipleVTIMEZONESAndMultipleValidEvents ( )

Definition at line 184 of file ICalendarTest.php.

184 {
185
186 $timezones = <<<EOT
187BEGIN:VTIMEZONE
188TZID:Europe/Berlin
189BEGIN:DAYLIGHT
190TZOFFSETFROM:+0100
191RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
192DTSTART:19810329T020000
193TZNAME:MESZ
194TZOFFSETTO:+0200
195END:DAYLIGHT
196BEGIN:STANDARD
197TZOFFSETFROM:+0200
198RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
199DTSTART:19961027T030000
200TZNAME:MEZ
201TZOFFSETTO:+0100
202END:STANDARD
203END:VTIMEZONE
204BEGIN:VTIMEZONE
205TZID:Europe/London
206BEGIN:DAYLIGHT
207TZOFFSETFROM:+0000
208RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
209DTSTART:19810329T010000
210TZNAME:GMT+01:00
211TZOFFSETTO:+0100
212END:DAYLIGHT
213BEGIN:STANDARD
214TZOFFSETFROM:+0100
215RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
216DTSTART:19961027T020000
217TZNAME:GMT
218TZOFFSETTO:+0000
219END:STANDARD
220END:VTIMEZONE
221EOT;
222
223 $event[] = <<<EOT
224BEGIN:VEVENT
225UID:foo1
226DTSTAMP:20140122T232710Z
227DTSTART:20140101T010000Z
228END:VEVENT
229EOT;
230
231 $event[] = <<<EOT
232BEGIN:VEVENT
233UID:foo2
234DTSTAMP:20140122T232710Z
235DTSTART:20140101T020000Z
236END:VEVENT
237EOT;
238
239 $event[] = <<<EOT
240BEGIN:VEVENT
241UID:foo3
242DTSTAMP:20140122T232710Z
243DTSTART:20140101T030000Z
244END:VEVENT
245EOT;
246
247 $data = <<<EOT
248BEGIN:VCALENDAR
249$timezones
250$event[0]
251$event[1]
252$event[2]
253END:VCALENDAR
254
255EOT;
256 $tempFile = $this->createStream($data);
257
258 $objects = new ICalendar($tempFile);
259
260 $return = "";
261 $i = 0;
262 while ($object = $objects->getNext()) {
263
264 $expected = <<<EOT
265BEGIN:VCALENDAR
266VERSION:2.0
267PRODID:-//Sabre//Sabre VObject $this->version//EN
268CALSCALE:GREGORIAN
269$timezones
270$event[$i]
271END:VCALENDAR
272
273EOT;
274 $expected = str_replace("\n", "\r\n", $expected);
275
276 $this->assertEquals($expected, $object->serialize());
277 $return .= $object->serialize();
278 $i++;
279
280 }
281
282 $this->assertEquals([], VObject\Reader::read($return)->validate());
283 }

References $data, $i, Sabre\VObject\Splitter\ICalendarTest\createStream(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testICalendarImportValidEvent()

Sabre\VObject\Splitter\ICalendarTest::testICalendarImportValidEvent ( )

Definition at line 25 of file ICalendarTest.php.

25 {
26
27 $data = <<<EOT
28BEGIN:VCALENDAR
29BEGIN:VEVENT
30UID:foo
31DTSTAMP:20140122T233226Z
32DTSTART:20140101T070000Z
33END:VEVENT
34END:VCALENDAR
35EOT;
36 $tempFile = $this->createStream($data);
37
38 $objects = new ICalendar($tempFile);
39
40 $return = "";
41 while ($object = $objects->getNext()) {
42 $return .= $object->serialize();
43 }
44 $this->assertEquals([], VObject\Reader::read($return)->validate());
45 }

References $data, Sabre\VObject\Splitter\ICalendarTest\createStream(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testICalendarImportWithOutVTIMEZONES()

Sabre\VObject\Splitter\ICalendarTest::testICalendarImportWithOutVTIMEZONES ( )

Definition at line 285 of file ICalendarTest.php.

285 {
286
287 $data = <<<EOT
288BEGIN:VCALENDAR
289VERSION:2.0
290PRODID:-//Apple Inc.//Mac OS X 10.8//EN
291CALSCALE:GREGORIAN
292BEGIN:VEVENT
293CREATED:20120605T072109Z
294UID:D6716295-C10F-4B20-82F9-E1A3026C7DCF
295DTEND;VALUE=DATE:20120717
296TRANSP:TRANSPARENT
297SUMMARY:Start Vorbereitung
298DTSTART;VALUE=DATE:20120716
299DTSTAMP:20120605T072115Z
300SEQUENCE:2
301BEGIN:VALARM
302X-WR-ALARMUID:A99EDA6A-35EB-4446-B8BC-CDA3C60C627D
303UID:A99EDA6A-35EB-4446-B8BC-CDA3C60C627D
304TRIGGER:-PT15H
305X-APPLE-DEFAULT-ALARM:TRUE
306ATTACH;VALUE=URI:Basso
307ACTION:AUDIO
308END:VALARM
309END:VEVENT
310END:VCALENDAR
311
312EOT;
313 $tempFile = $this->createStream($data);
314
315 $objects = new ICalendar($tempFile);
316
317 $return = "";
318 while ($object = $objects->getNext()) {
319 $return .= $object->serialize();
320 }
321
322 $messages = VObject\Reader::read($return)->validate();
323 $this->assertEquals([], $messages);
324 }

References $data, $messages, Sabre\VObject\Splitter\ICalendarTest\createStream(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testICalendarImportWrongType()

Sabre\VObject\Splitter\ICalendarTest::testICalendarImportWrongType ( )

@expectedException Sabre\VObject\ParseException

Definition at line 50 of file ICalendarTest.php.

50 {
51
52 $data = <<<EOT
53BEGIN:VCARD
54UID:foo1
55END:VCARD
56BEGIN:VCARD
57UID:foo2
58END:VCARD
59EOT;
60 $tempFile = $this->createStream($data);
61
62 $objects = new ICalendar($tempFile);
63
64 }

References $data, and Sabre\VObject\Splitter\ICalendarTest\createStream().

+ Here is the call graph for this function:

Field Documentation

◆ $version

Sabre\VObject\Splitter\ICalendarTest::$version
protected

Definition at line 10 of file ICalendarTest.php.


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