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

Public Member Functions

 testReadComponent ()
 
 testReadStream ()
 
 testReadComponentUnixNewLine ()
 
 testReadComponentLineFold ()
 
 testReadCorruptComponent ()
 Sabre More...
 
 testReadCorruptSubComponent ()
 Sabre More...
 
 testReadProperty ()
 
 testReadPropertyWithNewLine ()
 
 testReadMappedProperty ()
 
 testReadMappedPropertyGrouped ()
 
 testReadBrokenLine ()
 Sabre More...
 
 testReadPropertyInComponent ()
 
 testReadNestedComponent ()
 
 testReadPropertyParameter ()
 
 testReadPropertyRepeatingParameter ()
 
 testReadPropertyRepeatingNamelessGuessedParameter ()
 
 testReadPropertyNoName ()
 
 testReadPropertyParameterExtraColon ()
 
 testReadProperty2Parameters ()
 
 testReadPropertyParameterQuoted ()
 
 testReadPropertyParameterNewLines ()
 
 testReadPropertyParameterQuotedColon ()
 
 testReadForgiving ()
 
 testReadWithInvalidLine ()
 
 testReadIncompleteFile ()
 Reported as Issue 32. More...
 
 testReadBrokenInput ()
 
 testReadBOM ()
 
 testReadXMLComponent ()
 
 testReadXMLStream ()
 

Detailed Description

Definition at line 7 of file ReaderTest.php.

Member Function Documentation

◆ testReadBOM()

Sabre\VObject\ReaderTest::testReadBOM ( )

Definition at line 442 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

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  }
$result
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:

◆ testReadBrokenInput()

Sabre\VObject\ReaderTest::testReadBrokenInput ( )

Definition at line 436 of file ReaderTest.php.

References Sabre\VObject\Reader\read().

436  {
437 
438  Reader::read(false);
439 
440  }
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
+ Here is the call graph for this function:

◆ testReadBrokenLine()

Sabre\VObject\ReaderTest::testReadBrokenLine ( )

Sabre

Definition at line 134 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

134  {
135 
136  $data = "BEGIN:VCALENDAR\r\nPROPNAME;propValue";
138 
139  }
$result
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:

◆ testReadComponent()

Sabre\VObject\ReaderTest::testReadComponent ( )

Definition at line 9 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

9  {
10 
11  $data = "BEGIN:VCALENDAR\r\nEND:VCALENDAR";
12 
14 
15  $this->assertInstanceOf('Sabre\\VObject\\Component', $result);
16  $this->assertEquals('VCALENDAR', $result->name);
17  $this->assertEquals(0, count($result->children()));
18 
19  }
$result
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:

◆ testReadComponentLineFold()

Sabre\VObject\ReaderTest::testReadComponentLineFold ( )

Definition at line 49 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

49  {
50 
51  $data = "BEGIN:\r\n\tVCALENDAR\r\nE\r\n ND:VCALENDAR";
52 
54 
55  $this->assertInstanceOf('Sabre\\VObject\\Component', $result);
56  $this->assertEquals('VCALENDAR', $result->name);
57  $this->assertEquals(0, count($result->children()));
58 
59  }
$result
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:

◆ testReadComponentUnixNewLine()

Sabre\VObject\ReaderTest::testReadComponentUnixNewLine ( )

Definition at line 37 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

37  {
38 
39  $data = "BEGIN:VCALENDAR\nEND:VCALENDAR";
40 
42 
43  $this->assertInstanceOf('Sabre\\VObject\\Component', $result);
44  $this->assertEquals('VCALENDAR', $result->name);
45  $this->assertEquals(0, count($result->children()));
46 
47  }
$result
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:

◆ testReadCorruptComponent()

Sabre\VObject\ReaderTest::testReadCorruptComponent ( )

Sabre

Definition at line 64 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

64  {
65 
66  $data = "BEGIN:VCALENDAR\r\nEND:FOO";
67 
69 
70  }
$result
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:

◆ testReadCorruptSubComponent()

Sabre\VObject\ReaderTest::testReadCorruptSubComponent ( )

Sabre

Definition at line 75 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

75  {
76 
77  $data = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:FOO\r\nEND:VCALENDAR";
78 
80 
81  }
$result
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:

◆ testReadForgiving()

Sabre\VObject\ReaderTest::testReadForgiving ( )

Definition at line 334 of file ReaderTest.php.

References $data, $result, Sabre\VObject\Reader\OPTION_FORGIVING, and Sabre\VObject\Reader\read().

334  {
335 
336  $data = [
337  "BEGIN:VCALENDAR",
338  "X_PROP:propValue",
339  "END:VCALENDAR"
340  ];
341 
342  $caught = false;
343  try {
344  $result = Reader::read(implode("\r\n", $data));
345  } catch (ParseException $e) {
346  $caught = true;
347  }
348 
349  $this->assertEquals(true, $caught);
350 
351  $result = Reader::read(implode("\r\n", $data), Reader::OPTION_FORGIVING);
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  }
$result
const OPTION_FORGIVING
If this option is passed to the reader, it will be less strict about the validity of the lines...
Definition: Reader.php:21
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:

◆ testReadIncompleteFile()

Sabre\VObject\ReaderTest::testReadIncompleteFile ( )

Reported as Issue 32.

Definition at line 400 of file ReaderTest.php.

References Sabre\VObject\$input, Sabre\VObject\Reader\read(), and test().

400  {
401 
402  $input = <<<ICS
403 BEGIN:VCALENDAR
404 VERSION:1.0
405 BEGIN:VEVENT
406 X-FUNAMBOL-FOLDER:DEFAULT_FOLDER
407 X-FUNAMBOL-ALLDAY:0
408 DTSTART:20111017T110000Z
409 DTEND:20111017T123000Z
410 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
411 CATEGORIES:
412 LOCATION;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:Netviewer Meeting
413 PRIORITY:1
414 STATUS:3
415 X-MICROSOFT-CDO-REPLYTIME:20111017T064200Z
416 SUMMARY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:Kopieren: test
417 CLASS:PUBLIC
418 AALARM:
419 RRULE:
420 X-FUNAMBOL-BILLINGINFO:
421 X-FUNAMBOL-COMPANIES:
422 X-FUNAMBOL-MILEAGE:
423 X-FUNAMBOL-NOAGING:0
424 ATTENDEE;STATUS=NEEDS ACTION;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:'Heino' heino@test.com
425 ATTENDEE;STATUS=NEEDS ACTION;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:'Markus' test@test.com
426 ATTENDEE;STATUS=NEEDS AC
427 ICS;
428 
430 
431  }
if($argc< 3) $input
test()
Definition: build.php:107
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
+ Here is the call graph for this function:

◆ testReadMappedProperty()

Sabre\VObject\ReaderTest::testReadMappedProperty ( )

Definition at line 107 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

107  {
108 
109  $data = "BEGIN:VCALENDAR\r\nDTSTART:20110529\r\nEND:VCALENDAR";
111 
112  $result = $result->DTSTART;
113  $this->assertInstanceOf('Sabre\\VObject\\Property\\ICalendar\\DateTime', $result);
114  $this->assertEquals('DTSTART', $result->name);
115  $this->assertEquals('20110529', $result->getValue());
116 
117  }
$result
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:

◆ testReadMappedPropertyGrouped()

Sabre\VObject\ReaderTest::testReadMappedPropertyGrouped ( )

Definition at line 119 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

119  {
120 
121  $data = "BEGIN:VCALENDAR\r\nfoo.DTSTART:20110529\r\nEND:VCALENDAR";
123 
124  $result = $result->DTSTART;
125  $this->assertInstanceOf('Sabre\\VObject\\Property\\ICalendar\\DateTime', $result);
126  $this->assertEquals('DTSTART', $result->name);
127  $this->assertEquals('20110529', $result->getValue());
128 
129  }
$result
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:

◆ testReadNestedComponent()

Sabre\VObject\ReaderTest::testReadNestedComponent ( )

Definition at line 160 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

160  {
161 
162  $data = [
163  "BEGIN:VCALENDAR",
164  "BEGIN:VTIMEZONE",
165  "BEGIN:DAYLIGHT",
166  "END:DAYLIGHT",
167  "END:VTIMEZONE",
168  "END:VCALENDAR"
169  ];
170 
171  $result = Reader::read(implode("\r\n", $data));
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  }
$result
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:

◆ testReadProperty()

Sabre\VObject\ReaderTest::testReadProperty ( )

Definition at line 83 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

83  {
84 
85  $data = "BEGIN:VCALENDAR\r\nSUMMARY:propValue\r\nEND:VCALENDAR";
87 
88  $result = $result->SUMMARY;
89  $this->assertInstanceOf('Sabre\\VObject\\Property', $result);
90  $this->assertEquals('SUMMARY', $result->name);
91  $this->assertEquals('propValue', $result->getValue());
92 
93  }
$result
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:

◆ testReadProperty2Parameters()

Sabre\VObject\ReaderTest::testReadProperty2Parameters ( )

Definition at line 268 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

268  {
269 
270  $data = "BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=paramvalue;PARAMNAME2=paramvalue2:propValue\r\nEND:VCALENDAR";
272 
273  $result = $result->PROPNAME;
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  }
$result
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:

◆ testReadPropertyInComponent()

Sabre\VObject\ReaderTest::testReadPropertyInComponent ( )

Definition at line 141 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

141  {
142 
143  $data = [
144  "BEGIN:VCALENDAR",
145  "PROPNAME:propValue",
146  "END:VCALENDAR"
147  ];
148 
149  $result = Reader::read(implode("\r\n", $data));
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  }
$result
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:

◆ testReadPropertyNoName()

Sabre\VObject\ReaderTest::testReadPropertyNoName ( )

Definition at line 235 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

235  {
236 
237  $data = "BEGIN:VCALENDAR\r\nPROPNAME;PRODIGY:propValue\r\nEND:VCALENDAR";
239 
240  $result = $result->PROPNAME;
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  }
$result
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:

◆ testReadPropertyParameter()

Sabre\VObject\ReaderTest::testReadPropertyParameter ( )

Definition at line 185 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

185  {
186 
187  $data = "BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=paramvalue:propValue\r\nEND:VCALENDAR";
189 
190  $result = $result->PROPNAME;
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  }
$result
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:

◆ testReadPropertyParameterExtraColon()

Sabre\VObject\ReaderTest::testReadPropertyParameterExtraColon ( )

Definition at line 252 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

252  {
253 
254  $data = "BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=paramvalue:propValue:anotherrandomstring\r\nEND:VCALENDAR";
256 
257  $result = $result->PROPNAME;
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  }
$result
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:

◆ testReadPropertyParameterNewLines()

Sabre\VObject\ReaderTest::testReadPropertyParameterNewLines ( )

Definition at line 302 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

302  {
303 
304  $data = "BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=paramvalue1^nvalue2^^nvalue3:propValue\r\nEND:VCALENDAR";
306 
307  $result = $result->PROPNAME;
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  }
$result
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:

◆ testReadPropertyParameterQuoted()

Sabre\VObject\ReaderTest::testReadPropertyParameterQuoted ( )

Definition at line 286 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

286  {
287 
288  $data = "BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=\"paramvalue\":propValue\r\nEND:VCALENDAR";
290 
291  $result = $result->PROPNAME;
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  }
$result
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:

◆ testReadPropertyParameterQuotedColon()

Sabre\VObject\ReaderTest::testReadPropertyParameterQuotedColon ( )

Definition at line 319 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

319  {
320 
321  $data = "BEGIN:VCALENDAR\r\nPROPNAME;PARAMNAME=\"param:value\":propValue\r\nEND:VCALENDAR";
323  $result = $result->PROPNAME;
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  }
$result
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:

◆ testReadPropertyRepeatingNamelessGuessedParameter()

Sabre\VObject\ReaderTest::testReadPropertyRepeatingNamelessGuessedParameter ( )

Definition at line 218 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

218  {
219 
220  $data = "BEGIN:VCALENDAR\r\nPROPNAME;WORK;VOICE;PREF:propValue\r\nEND:VCALENDAR";
222 
223  $result = $result->PROPNAME;
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  }
$result
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:

◆ testReadPropertyRepeatingParameter()

Sabre\VObject\ReaderTest::testReadPropertyRepeatingParameter ( )

Definition at line 201 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

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 
206  $result = $result->PROPNAME;
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  }
$result
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:

◆ testReadPropertyWithNewLine()

Sabre\VObject\ReaderTest::testReadPropertyWithNewLine ( )

Definition at line 95 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\read().

95  {
96 
97  $data = "BEGIN:VCALENDAR\r\nSUMMARY:Line1\\nLine2\\NLine3\\\\Not the 4th line!\r\nEND:VCALENDAR";
99 
100  $result = $result->SUMMARY;
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  }
$result
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:

◆ testReadStream()

Sabre\VObject\ReaderTest::testReadStream ( )

Definition at line 21 of file ReaderTest.php.

References $data, $result, GuzzleHttp\Psr7\$stream, and Sabre\VObject\Reader\read().

21  {
22 
23  $data = "BEGIN:VCALENDAR\r\nEND:VCALENDAR";
24 
25  $stream = fopen('php://memory', 'r+');
26  fwrite($stream, $data);
27  rewind($stream);
28 
30 
31  $this->assertInstanceOf('Sabre\\VObject\\Component', $result);
32  $this->assertEquals('VCALENDAR', $result->name);
33  $this->assertEquals(0, count($result->children()));
34 
35  }
$result
$stream
PHP stream implementation.
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:

◆ testReadWithInvalidLine()

Sabre\VObject\ReaderTest::testReadWithInvalidLine ( )

Definition at line 364 of file ReaderTest.php.

References $data, $result, Sabre\VObject\Reader\OPTION_IGNORE_INVALID_LINES, and Sabre\VObject\Reader\read().

364  {
365 
366  $data = [
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 {
375  $result = Reader::read(implode("\r\n", $data));
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  }
$result
const OPTION_IGNORE_INVALID_LINES
If this option is turned on, any lines we cannot parse will be ignored by the reader.
Definition: Reader.php:27
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:

◆ testReadXMLComponent()

Sabre\VObject\ReaderTest::testReadXMLComponent ( )

Definition at line 453 of file ReaderTest.php.

References $data, $result, and Sabre\VObject\Reader\readXML().

453  {
454 
455  $data = <<<XML
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>
461 XML;
462 
464 
465  $this->assertInstanceOf('Sabre\\VObject\\Component', $result);
466  $this->assertEquals('VCALENDAR', $result->name);
467  $this->assertEquals(0, count($result->children()));
468 
469  }
$result
static readXML($data, $options=0)
Parses a xCard or xCal object, and returns the top component.
Definition: Reader.php:89
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ testReadXMLStream()

Sabre\VObject\ReaderTest::testReadXMLStream ( )

Definition at line 471 of file ReaderTest.php.

References $data, $result, GuzzleHttp\Psr7\$stream, and Sabre\VObject\Reader\readXML().

471  {
472 
473  $data = <<<XML
474 <?xml version="1.0" encoding="utf-8"?>
475 <icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0">
476  <vcalendar>
477  </vcalendar>
478 </icalendar>
479 XML;
480 
481  $stream = fopen('php://memory', 'r+');
482  fwrite($stream, $data);
483  rewind($stream);
484 
486 
487  $this->assertInstanceOf('Sabre\\VObject\\Component', $result);
488  $this->assertEquals('VCALENDAR', $result->name);
489  $this->assertEquals(0, count($result->children()));
490 
491  }
$result
$stream
PHP stream implementation.
static readXML($data, $options=0)
Parses a xCard or xCal object, and returns the top component.
Definition: Reader.php:89
$data
Definition: bench.php:6
+ Here is the call graph for this function:

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