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 ()
 Sabre More...
 
 testICalendarImportEndOfData ()
 
 testICalendarImportInvalidEvent ()
 Sabre 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.

References Sabre\VObject\Version\VERSION.

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

◆ testICalendarImportEndOfData()

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

Definition at line 66 of file ICalendarTest.php.

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

66  {
67  $data = <<<EOT
68 BEGIN:VCALENDAR
69 BEGIN:VEVENT
70 UID:foo
71 DTSTAMP:20140122T233226Z
72 END:VEVENT
73 END:VCALENDAR
74 EOT;
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  }
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testICalendarImportEventWithoutUID()

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

Definition at line 148 of file ICalendarTest.php.

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

148  {
149 
150  $data = <<<EOT
151 BEGIN:VCALENDAR
152 VERSION:2.0
153 PRODID:-//Sabre//Sabre VObject $this->version//EN
154 CALSCALE:GREGORIAN
155 BEGIN:VEVENT
156 DTSTART:20140101T040000Z
157 DTSTAMP:20140122T233226Z
158 END:VEVENT
159 END:VCALENDAR
160 
161 EOT;
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']; },
176  $messages
177  );
178  $this->fail('Validation errors: ' . implode("\n", $messages));
179  } else {
180  $this->assertEquals([], $messages);
181  }
182  }
$messages
Definition: en.php:5
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testICalendarImportInvalidEvent()

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

Sabre

Definition at line 89 of file ICalendarTest.php.

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

89  {
90  $data = <<<EOT
91 EOT;
92  $tempFile = $this->createStream($data);
93  $objects = new ICalendar($tempFile);
94 
95  }
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testICalendarImportMultipleValidEvents()

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

Definition at line 97 of file ICalendarTest.php.

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

97  {
98 
99  $event[] = <<<EOT
100 BEGIN:VEVENT
101 UID:foo1
102 DTSTAMP:20140122T233226Z
103 DTSTART:20140101T050000Z
104 END:VEVENT
105 EOT;
106 
107 $event[] = <<<EOT
108 BEGIN:VEVENT
109 UID:foo2
110 DTSTAMP:20140122T233226Z
111 DTSTART:20140101T060000Z
112 END:VEVENT
113 EOT;
114 
115  $data = <<<EOT
116 BEGIN:VCALENDAR
117 $event[0]
118 $event[1]
119 END:VCALENDAR
120 
121 EOT;
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
131 BEGIN:VCALENDAR
132 VERSION:2.0
133 PRODID:-//Sabre//Sabre VObject $this->version//EN
134 CALSCALE:GREGORIAN
135 $event[$i]
136 END:VCALENDAR
137 
138 EOT;
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  }
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
$i
Definition: disco.tpl.php:19
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testICalendarImportMultipleVTIMEZONESAndMultipleValidEvents()

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

Definition at line 184 of file ICalendarTest.php.

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

184  {
185 
186  $timezones = <<<EOT
187 BEGIN:VTIMEZONE
188 TZID:Europe/Berlin
189 BEGIN:DAYLIGHT
190 TZOFFSETFROM:+0100
191 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
192 DTSTART:19810329T020000
193 TZNAME:MESZ
194 TZOFFSETTO:+0200
195 END:DAYLIGHT
196 BEGIN:STANDARD
197 TZOFFSETFROM:+0200
198 RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
199 DTSTART:19961027T030000
200 TZNAME:MEZ
201 TZOFFSETTO:+0100
202 END:STANDARD
203 END:VTIMEZONE
204 BEGIN:VTIMEZONE
205 TZID:Europe/London
206 BEGIN:DAYLIGHT
207 TZOFFSETFROM:+0000
208 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
209 DTSTART:19810329T010000
210 TZNAME:GMT+01:00
211 TZOFFSETTO:+0100
212 END:DAYLIGHT
213 BEGIN:STANDARD
214 TZOFFSETFROM:+0100
215 RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
216 DTSTART:19961027T020000
217 TZNAME:GMT
218 TZOFFSETTO:+0000
219 END:STANDARD
220 END:VTIMEZONE
221 EOT;
222 
223  $event[] = <<<EOT
224 BEGIN:VEVENT
225 UID:foo1
226 DTSTAMP:20140122T232710Z
227 DTSTART:20140101T010000Z
228 END:VEVENT
229 EOT;
230 
231  $event[] = <<<EOT
232 BEGIN:VEVENT
233 UID:foo2
234 DTSTAMP:20140122T232710Z
235 DTSTART:20140101T020000Z
236 END:VEVENT
237 EOT;
238 
239  $event[] = <<<EOT
240 BEGIN:VEVENT
241 UID:foo3
242 DTSTAMP:20140122T232710Z
243 DTSTART:20140101T030000Z
244 END:VEVENT
245 EOT;
246 
247  $data = <<<EOT
248 BEGIN:VCALENDAR
249 $timezones
250 $event[0]
251 $event[1]
252 $event[2]
253 END:VCALENDAR
254 
255 EOT;
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
265 BEGIN:VCALENDAR
266 VERSION:2.0
267 PRODID:-//Sabre//Sabre VObject $this->version//EN
268 CALSCALE:GREGORIAN
269 $timezones
270 $event[$i]
271 END:VCALENDAR
272 
273 EOT;
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  }
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
$i
Definition: disco.tpl.php:19
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testICalendarImportValidEvent()

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

Definition at line 25 of file ICalendarTest.php.

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

25  {
26 
27  $data = <<<EOT
28 BEGIN:VCALENDAR
29 BEGIN:VEVENT
30 UID:foo
31 DTSTAMP:20140122T233226Z
32 DTSTART:20140101T070000Z
33 END:VEVENT
34 END:VCALENDAR
35 EOT;
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  }
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testICalendarImportWithOutVTIMEZONES()

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

Definition at line 285 of file ICalendarTest.php.

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

285  {
286 
287  $data = <<<EOT
288 BEGIN:VCALENDAR
289 VERSION:2.0
290 PRODID:-//Apple Inc.//Mac OS X 10.8//EN
291 CALSCALE:GREGORIAN
292 BEGIN:VEVENT
293 CREATED:20120605T072109Z
294 UID:D6716295-C10F-4B20-82F9-E1A3026C7DCF
295 DTEND;VALUE=DATE:20120717
296 TRANSP:TRANSPARENT
297 SUMMARY:Start Vorbereitung
298 DTSTART;VALUE=DATE:20120716
299 DTSTAMP:20120605T072115Z
300 SEQUENCE:2
301 BEGIN:VALARM
302 X-WR-ALARMUID:A99EDA6A-35EB-4446-B8BC-CDA3C60C627D
303 UID:A99EDA6A-35EB-4446-B8BC-CDA3C60C627D
304 TRIGGER:-PT15H
305 X-APPLE-DEFAULT-ALARM:TRUE
306 ATTACH;VALUE=URI:Basso
307 ACTION:AUDIO
308 END:VALARM
309 END:VEVENT
310 END:VCALENDAR
311 
312 EOT;
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  }
$messages
Definition: en.php:5
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testICalendarImportWrongType()

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

Sabre

Definition at line 50 of file ICalendarTest.php.

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

50  {
51 
52  $data = <<<EOT
53 BEGIN:VCARD
54 UID:foo1
55 END:VCARD
56 BEGIN:VCARD
57 UID:foo2
58 END:VCARD
59 EOT;
60  $tempFile = $this->createStream($data);
61 
62  $objects = new ICalendar($tempFile);
63 
64  }
$data
Definition: bench.php:6
+ 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: