Definition at line 7 of file ReaderTest.php.
◆ testReadBOM()
Sabre\VObject\ReaderTest::testReadBOM |
( |
| ) |
|
Definition at line 442 of file ReaderTest.php.
442 {
443
444 $data = chr(0xef) . chr(0xbb) . chr(0xbf) .
"BEGIN:VCALENDAR\r\nEND:VCALENDAR";
446
447 $this->assertInstanceOf(
'Sabre\\VObject\\Component',
$result);
448 $this->assertEquals(
'VCALENDAR',
$result->name);
449 $this->assertEquals(0, count(
$result->children()));
450
451 }
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadBrokenInput()
Sabre\VObject\ReaderTest::testReadBrokenInput |
( |
| ) |
|
◆ testReadBrokenLine()
Sabre\VObject\ReaderTest::testReadBrokenLine |
( |
| ) |
|
◆ testReadComponent()
Sabre\VObject\ReaderTest::testReadComponent |
( |
| ) |
|
◆ testReadComponentLineFold()
Sabre\VObject\ReaderTest::testReadComponentLineFold |
( |
| ) |
|
◆ testReadComponentUnixNewLine()
Sabre\VObject\ReaderTest::testReadComponentUnixNewLine |
( |
| ) |
|
◆ testReadCorruptComponent()
Sabre\VObject\ReaderTest::testReadCorruptComponent |
( |
| ) |
|
◆ testReadCorruptSubComponent()
Sabre\VObject\ReaderTest::testReadCorruptSubComponent |
( |
| ) |
|
◆ testReadForgiving()
Sabre\VObject\ReaderTest::testReadForgiving |
( |
| ) |
|
Definition at line 334 of file ReaderTest.php.
334 {
335
337 "BEGIN:VCALENDAR",
338 "X_PROP:propValue",
339 "END:VCALENDAR"
340 ];
341
342 $caught = false;
343 try {
345 } catch (ParseException $e) {
346 $caught = true;
347 }
348
349 $this->assertEquals(true, $caught);
350
352
353 $expected = implode("\r\n", [
354 "BEGIN:VCALENDAR",
355 "X_PROP:propValue",
356 "END:VCALENDAR",
357 ""
358 ]);
359
360 $this->assertEquals($expected,
$result->serialize());
361
362 }
const OPTION_FORGIVING
If this option is passed to the reader, it will be less strict about the validity of the lines.
References $data, $result, Sabre\VObject\Reader\OPTION_FORGIVING, and Sabre\VObject\Reader\read().
◆ testReadIncompleteFile()
Sabre\VObject\ReaderTest::testReadIncompleteFile |
( |
| ) |
|
Reported as Issue 32.
@expectedException \Sabre\VObject\ParseException
Definition at line 400 of file ReaderTest.php.
400 {
401
403BEGIN:VCALENDAR
404VERSION:1.0
405BEGIN:VEVENT
406X-FUNAMBOL-FOLDER:DEFAULT_FOLDER
407X-FUNAMBOL-ALLDAY:0
408DTSTART:20111017T110000Z
409DTEND:20111017T123000Z
410X-MICROSOFT-CDO-BUSYSTATUS:BUSY
411CATEGORIES:
412LOCATION;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:Netviewer Meeting
413PRIORITY:1
414STATUS:3
415X-MICROSOFT-CDO-REPLYTIME:20111017T064200Z
416SUMMARY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:Kopieren:
test
417CLASS:PUBLIC
418AALARM:
419RRULE:
420X-FUNAMBOL-BILLINGINFO:
421X-FUNAMBOL-COMPANIES:
422X-FUNAMBOL-MILEAGE:
423X-FUNAMBOL-NOAGING:0
424ATTENDEE;STATUS=NEEDS ACTION;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:
'Heino' heino@
test.com
425ATTENDEE;STATUS=NEEDS ACTION;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:
'Markus' test@
test.com
426ATTENDEE;STATUS=NEEDS AC
427ICS;
428
430
431 }
foreach($paths as $path) if($argc< 3) $input
References Sabre\VObject\$input, Sabre\VObject\Reader\read(), and test().
◆ testReadMappedProperty()
Sabre\VObject\ReaderTest::testReadMappedProperty |
( |
| ) |
|
◆ testReadMappedPropertyGrouped()
Sabre\VObject\ReaderTest::testReadMappedPropertyGrouped |
( |
| ) |
|
◆ testReadNestedComponent()
Sabre\VObject\ReaderTest::testReadNestedComponent |
( |
| ) |
|
Definition at line 160 of file ReaderTest.php.
160 {
161
163 "BEGIN:VCALENDAR",
164 "BEGIN:VTIMEZONE",
165 "BEGIN:DAYLIGHT",
166 "END:DAYLIGHT",
167 "END:VTIMEZONE",
168 "END:VCALENDAR"
169 ];
170
172
173 $this->assertInstanceOf(
'Sabre\\VObject\\Component',
$result);
174 $this->assertEquals(
'VCALENDAR',
$result->name);
175 $this->assertEquals(1, count(
$result->children()));
176 $this->assertInstanceOf(
'Sabre\\VObject\\Component',
$result->children()[0]);
177 $this->assertEquals(
'VTIMEZONE',
$result->children()[0]->name);
178 $this->assertEquals(1, count(
$result->children()[0]->children()));
179 $this->assertInstanceOf(
'Sabre\\VObject\\Component',
$result->children()[0]->children()[0]);
180 $this->assertEquals(
'DAYLIGHT',
$result->children()[0]->children()[0]->name);
181
182
183 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadProperty()
Sabre\VObject\ReaderTest::testReadProperty |
( |
| ) |
|
◆ testReadProperty2Parameters()
Sabre\VObject\ReaderTest::testReadProperty2Parameters |
( |
| ) |
|
Definition at line 268 of file ReaderTest.php.
268 {
269
270 $data =
"BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=paramvalue;PARAMNAME2=paramvalue2:propValue\r\nEND:VCALENDAR";
272
274
275 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
276 $this->assertEquals(
'PROPNAME',
$result->name);
277 $this->assertEquals(
'propValue',
$result->getValue());
278 $this->assertEquals(2, count(
$result->parameters()));
279 $this->assertEquals(
'PARAMNAME',
$result->parameters[
'PARAMNAME']->name);
280 $this->assertEquals(
'paramvalue',
$result->parameters[
'PARAMNAME']->getValue());
281 $this->assertEquals(
'PARAMNAME2',
$result->parameters[
'PARAMNAME2']->name);
282 $this->assertEquals(
'paramvalue2',
$result->parameters[
'PARAMNAME2']->getValue());
283
284 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyInComponent()
Sabre\VObject\ReaderTest::testReadPropertyInComponent |
( |
| ) |
|
Definition at line 141 of file ReaderTest.php.
141 {
142
144 "BEGIN:VCALENDAR",
145 "PROPNAME:propValue",
146 "END:VCALENDAR"
147 ];
148
150
151 $this->assertInstanceOf(
'Sabre\\VObject\\Component',
$result);
152 $this->assertEquals(
'VCALENDAR',
$result->name);
153 $this->assertEquals(1, count(
$result->children()));
154 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result->children()[0]);
155 $this->assertEquals(
'PROPNAME',
$result->children()[0]->name);
156 $this->assertEquals(
'propValue',
$result->children()[0]->getValue());
157
158 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyNoName()
Sabre\VObject\ReaderTest::testReadPropertyNoName |
( |
| ) |
|
Definition at line 235 of file ReaderTest.php.
235 {
236
237 $data =
"BEGIN:VCALENDAR\r\nPROPNAME;PRODIGY:propValue\r\nEND:VCALENDAR";
239
241
242 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
243 $this->assertEquals(
'PROPNAME',
$result->name);
244 $this->assertEquals(
'propValue',
$result->getValue());
245 $this->assertEquals(1, count(
$result->parameters()));
246 $this->assertEquals(
'TYPE',
$result->parameters[
'TYPE']->name);
247 $this->assertTrue(
$result->parameters[
'TYPE']->noName);
248 $this->assertEquals(
'PRODIGY',
$result->parameters[
'TYPE']);
249
250 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyParameter()
Sabre\VObject\ReaderTest::testReadPropertyParameter |
( |
| ) |
|
Definition at line 185 of file ReaderTest.php.
185 {
186
187 $data =
"BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=paramvalue:propValue\r\nEND:VCALENDAR";
189
191
192 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
193 $this->assertEquals(
'PROPNAME',
$result->name);
194 $this->assertEquals(
'propValue',
$result->getValue());
195 $this->assertEquals(1, count(
$result->parameters()));
196 $this->assertEquals(
'PARAMNAME',
$result->parameters[
'PARAMNAME']->name);
197 $this->assertEquals(
'paramvalue',
$result->parameters[
'PARAMNAME']->getValue());
198
199 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyParameterExtraColon()
Sabre\VObject\ReaderTest::testReadPropertyParameterExtraColon |
( |
| ) |
|
Definition at line 252 of file ReaderTest.php.
252 {
253
254 $data =
"BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=paramvalue:propValue:anotherrandomstring\r\nEND:VCALENDAR";
256
258
259 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
260 $this->assertEquals(
'PROPNAME',
$result->name);
261 $this->assertEquals(
'propValue:anotherrandomstring',
$result->getValue());
262 $this->assertEquals(1, count(
$result->parameters()));
263 $this->assertEquals(
'PARAMNAME',
$result->parameters[
'PARAMNAME']->name);
264 $this->assertEquals(
'paramvalue',
$result->parameters[
'PARAMNAME']->getValue());
265
266 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyParameterNewLines()
Sabre\VObject\ReaderTest::testReadPropertyParameterNewLines |
( |
| ) |
|
Definition at line 302 of file ReaderTest.php.
302 {
303
304 $data =
"BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=paramvalue1^nvalue2^^nvalue3:propValue\r\nEND:VCALENDAR";
306
308
309 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
310 $this->assertEquals(
'PROPNAME',
$result->name);
311 $this->assertEquals(
'propValue',
$result->getValue());
312
313 $this->assertEquals(1, count(
$result->parameters()));
314 $this->assertEquals(
'PARAMNAME',
$result->parameters[
'PARAMNAME']->name);
315 $this->assertEquals(
"paramvalue1\nvalue2^nvalue3",
$result->parameters[
'PARAMNAME']->getValue());
316
317 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyParameterQuoted()
Sabre\VObject\ReaderTest::testReadPropertyParameterQuoted |
( |
| ) |
|
Definition at line 286 of file ReaderTest.php.
286 {
287
288 $data =
"BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=\"paramvalue\":propValue\r\nEND:VCALENDAR";
290
292
293 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
294 $this->assertEquals(
'PROPNAME',
$result->name);
295 $this->assertEquals(
'propValue',
$result->getValue());
296 $this->assertEquals(1, count(
$result->parameters()));
297 $this->assertEquals(
'PARAMNAME',
$result->parameters[
'PARAMNAME']->name);
298 $this->assertEquals(
'paramvalue',
$result->parameters[
'PARAMNAME']->getValue());
299
300 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyParameterQuotedColon()
Sabre\VObject\ReaderTest::testReadPropertyParameterQuotedColon |
( |
| ) |
|
Definition at line 319 of file ReaderTest.php.
319 {
320
321 $data =
"BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=\"param:value\":propValue\r\nEND:VCALENDAR";
324
325 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
326 $this->assertEquals(
'PROPNAME',
$result->name);
327 $this->assertEquals(
'propValue',
$result->getValue());
328 $this->assertEquals(1, count(
$result->parameters()));
329 $this->assertEquals(
'PARAMNAME',
$result->parameters[
'PARAMNAME']->name);
330 $this->assertEquals(
'param:value',
$result->parameters[
'PARAMNAME']->getValue());
331
332 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyRepeatingNamelessGuessedParameter()
Sabre\VObject\ReaderTest::testReadPropertyRepeatingNamelessGuessedParameter |
( |
| ) |
|
Definition at line 218 of file ReaderTest.php.
218 {
219
220 $data =
"BEGIN:VCALENDAR\r\nPROPNAME;WORK;VOICE;PREF:propValue\r\nEND:VCALENDAR";
222
224
225 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
226 $this->assertEquals(
'PROPNAME',
$result->name);
227 $this->assertEquals(
'propValue',
$result->getValue());
228 $this->assertEquals(1, count(
$result->parameters()));
229 $this->assertEquals(
'TYPE',
$result->parameters[
'TYPE']->name);
230 $this->assertEquals(
'WORK,VOICE,PREF',
$result->parameters[
'TYPE']->getValue());
231 $this->assertEquals([
'WORK',
'VOICE',
'PREF'],
$result->parameters[
'TYPE']->getParts());
232
233 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyRepeatingParameter()
Sabre\VObject\ReaderTest::testReadPropertyRepeatingParameter |
( |
| ) |
|
Definition at line 201 of file ReaderTest.php.
201 {
202
203 $data =
"BEGIN:VCALENDAR\r\nPROPNAME;N=1;N=2;N=3,4;N=\"5\",6;N=\"7,8\";N=9,10;N=^'11^':propValue\r\nEND:VCALENDAR";
205
207
208 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
209 $this->assertEquals(
'PROPNAME',
$result->name);
210 $this->assertEquals(
'propValue',
$result->getValue());
211 $this->assertEquals(1, count(
$result->parameters()));
212 $this->assertEquals(
'N',
$result->parameters[
'N']->name);
213 $this->assertEquals(
'1,2,3,4,5,6,7,8,9,10,"11"',
$result->parameters[
'N']->getValue());
214 $this->assertEquals([1, 2, 3, 4, 5, 6,
"7,8", 9, 10,
'"11"'],
$result->parameters[
'N']->getParts());
215
216 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadPropertyWithNewLine()
Sabre\VObject\ReaderTest::testReadPropertyWithNewLine |
( |
| ) |
|
Definition at line 95 of file ReaderTest.php.
95 {
96
97 $data =
"BEGIN:VCALENDAR\r\nSUMMARY:Line1\\nLine2\\NLine3\\\\Not the 4th line!\r\nEND:VCALENDAR";
99
101 $this->assertInstanceOf(
'Sabre\\VObject\\Property',
$result);
102 $this->assertEquals(
'SUMMARY',
$result->name);
103 $this->assertEquals(
"Line1\nLine2\nLine3\\Not the 4th line!",
$result->getValue());
104
105 }
References $data, $result, and Sabre\VObject\Reader\read().
◆ testReadStream()
Sabre\VObject\ReaderTest::testReadStream |
( |
| ) |
|
◆ testReadWithInvalidLine()
Sabre\VObject\ReaderTest::testReadWithInvalidLine |
( |
| ) |
|
Definition at line 364 of file ReaderTest.php.
364 {
365
367 "BEGIN:VCALENDAR",
368 "DESCRIPTION:propValue",
369 "Yes, we've actually seen a file with non-idented property values on multiple lines",
370 "END:VCALENDAR"
371 ];
372
373 $caught = false;
374 try {
376 } catch (ParseException $e) {
377 $caught = true;
378 }
379
380 $this->assertEquals(true, $caught);
381
383
384 $expected = implode("\r\n", [
385 "BEGIN:VCALENDAR",
386 "DESCRIPTION:propValue",
387 "END:VCALENDAR",
388 ""
389 ]);
390
391 $this->assertEquals($expected,
$result->serialize());
392
393 }
const OPTION_IGNORE_INVALID_LINES
If this option is turned on, any lines we cannot parse will be ignored by the reader.
References $data, $result, Sabre\VObject\Reader\OPTION_IGNORE_INVALID_LINES, and Sabre\VObject\Reader\read().
◆ testReadXMLComponent()
Sabre\VObject\ReaderTest::testReadXMLComponent |
( |
| ) |
|
Definition at line 453 of file ReaderTest.php.
453 {
454
456<?xml version="1.0" encoding="utf-8"?>
457<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0">
458 <vcalendar>
459 </vcalendar>
460</icalendar>
461XML;
462
464
465 $this->assertInstanceOf(
'Sabre\\VObject\\Component',
$result);
466 $this->assertEquals(
'VCALENDAR',
$result->name);
467 $this->assertEquals(0, count(
$result->children()));
468
469 }
static readXML($data, $options=0)
Parses a xCard or xCal object, and returns the top component.
References $data, $result, and Sabre\VObject\Reader\readXML().
◆ testReadXMLStream()
Sabre\VObject\ReaderTest::testReadXMLStream |
( |
| ) |
|
The documentation for this class was generated from the following file: