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
public function testQuotedParameters()
50
$ical = new Horde_Icalendar();
51
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/quoted-params.ics'));
52
$attr = $ical->getComponent(0)->getAttribute('ORGANIZER', true);
59
public function testVcalendar20()
61
$ical = new Horde_Icalendar();
62
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/vcal20.ics'));
72
'value' => '-//Google Inc//Google Calendar 70.9054//EN',
75
0 => '-//Google Inc//Google Calendar 70.9054//EN',
96
'value' => 'GREGORIAN',
108
'value' => 'PUBLISH',
116
'name' => 'X-WR-CALNAME',
120
'value' => 'PEAR - PHP Extension and Application Repository',
123
0 => 'PEAR - PHP Extension and Application Repository',
128
'name' => 'X-WR-TIMEZONE',
132
'value' => 'Atlantic/Reykjavik',
135
0 => 'Atlantic/Reykjavik',
140
'name' => 'X-WR-CALDESC',
144
'value' => 'pear.php.net activity calendar, bug triage, group meetings, qa, conferences or similar',
147
0 => 'pear.php.net activity calendar, bug triage, group meetings, qa, conferences or similar',
151
$ical->getAllAttributes()
162
'value' => 1224950400,
174
'value' => 1224968400,
186
'value' => 1219138073,
198
'value' => 'ntnrt4go4482q2trk18bt62c0o@google.com',
201
0 => 'ntnrt4go4482q2trk18bt62c0o@google.com',
206
'name' => 'RECURRENCE-ID',
210
'value' => 1224950400,
234
'value' => 1204763165,
242
'name' => 'DESCRIPTION',
246
'value' => 'Bug Triage session
248
Not been invited ? Want to attend ? Let us know and we\'ll add you!',
251
0 => 'Bug Triage session
253
Not been invited ? Want to attend ? Let us know and we\'ll add you!',
258
'name' => 'LAST-MODIFIED',
262
'value' => 1216413606,
270
'name' => 'LOCATION',
274
'value' => '#pear-bugs Efnet',
277
0 => '#pear-bugs Efnet',
282
'name' => 'SEQUENCE',
298
'value' => 'CONFIRMED',
310
'value' => 'Bug Triage',
330
'name' => 'CATEGORIES',
334
'value' => 'foo,bar,fuz buz,blah, blah',
344
$ical->getComponent(0)->getAllAttributes()
348
public function testBug7423()
350
$ical = new Horde_Icalendar();
351
$ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/bug7423.ics'));
353
array('SUMMARY' => 'birthday'),
354
$ical->getComponent(0)->toHash(true)