5
* @subpackage UnitTests
11
* @subpackage UnitTests
13
class Horde_Icalendar_ParseTest extends Horde_Test_Case
15
public function testEmptyData()
17
$ical = new Horde_Icalendar();
18
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/empty.ics'));
21
$ical->getComponents()
23
$ical->parsevCalendar('');
26
$ical->getComponents()
30
public function testEscapes()
32
$ical = new Horde_Icalendar();
33
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/escapes1.ics'));
35
array('There is a comma (escaped with a baskslash) in this sentence and some important words after it, see anything here?'),
36
$ical->getComponent(0)->getAttributeValues('DESCRIPTION')
39
array('There are important words after this dash - see anything here or have the words gone?'),
40
$ical->getComponent(1)->getAttributeValues('DESCRIPTION')
43
array('mailto:a@b.c'),
44
$ical->getComponent(1)->getAttributeValues('ORGANIZER')
48
$ical->getComponent(0)->getAttributeValues('CATEGORIES')
51
array('Foo', 'Foo,Bar', 'Bar'),
52
$ical->getComponent(1)->getAttributeValues('CATEGORIES')
56
public function testQuotedParameters()
58
$ical = new Horde_Icalendar();
59
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/quoted-params.ics'));
60
$attr = $ical->getComponent(0)->getAttribute('ORGANIZER', true);
67
public function testVcalendar20()
69
$ical = new Horde_Icalendar();
70
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/vcal20.ics'));
80
'value' => '-//Google Inc//Google Calendar 70.9054//EN',
83
0 => '-//Google Inc//Google Calendar 70.9054//EN',
100
'name' => 'CALSCALE',
104
'value' => 'GREGORIAN',
116
'value' => 'PUBLISH',
124
'name' => 'X-WR-CALNAME',
128
'value' => 'PEAR - PHP Extension and Application Repository',
131
0 => 'PEAR - PHP Extension and Application Repository',
136
'name' => 'X-WR-TIMEZONE',
140
'value' => 'Atlantic/Reykjavik',
143
0 => 'Atlantic/Reykjavik',
148
'name' => 'X-WR-CALDESC',
152
'value' => 'pear.php.net activity calendar, bug triage, group meetings, qa, conferences or similar',
155
0 => 'pear.php.net activity calendar, bug triage, group meetings, qa, conferences or similar',
159
$ical->getAllAttributes()
170
'value' => 1224950400,
182
'value' => 1224968400,
194
'value' => 1219138073,
206
'value' => 'ntnrt4go4482q2trk18bt62c0o@google.com',
209
0 => 'ntnrt4go4482q2trk18bt62c0o@google.com',
214
'name' => 'RECURRENCE-ID',
218
'value' => 1224950400,
242
'value' => 1204763165,
250
'name' => 'DESCRIPTION',
254
'value' => 'Bug Triage session
256
Not been invited ? Want to attend ? Let us know and we\'ll add you!',
259
0 => 'Bug Triage session
261
Not been invited ? Want to attend ? Let us know and we\'ll add you!',
266
'name' => 'LAST-MODIFIED',
270
'value' => 1216413606,
278
'name' => 'LOCATION',
282
'value' => '#pear-bugs Efnet',
285
0 => '#pear-bugs Efnet',
290
'name' => 'SEQUENCE',
306
'value' => 'CONFIRMED',
318
'value' => 'Bug Triage',
338
'name' => 'CATEGORIES',
342
'value' => 'foo,bar,fuz buz,blah, blah',
352
$ical->getComponent(0)->getAllAttributes()
356
public function testBug7423()
358
$ical = new Horde_Icalendar();
359
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug7423.ics'));
361
array('SUMMARY' => 'birthday'),
362
$ical->getComponent(0)->toHash(true)