/usr/share/php/tests/Horde_Icalendar/Horde/Icalendar/ExportTest.php is in php-horde-icalendar 2.0.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | <?php
/**
* @category Horde
* @package Icalendar
* @subpackage UnitTests
*/
/**
* @category Horde
* @package Icalendar
* @subpackage UnitTests
*/
class Horde_Icalendar_ExportTest extends Horde_Test_Case
{
public function testLineFolding()
{
$ical = new Horde_Icalendar();
$event = Horde_Icalendar::newComponent('vevent', $ical);
$event->setAttribute('UID', 'XXX');
$event->setAttribute('DTSTART', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DTSTAMP', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DESCRIPTION', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam sollicitudin faucibus mauris amet.');
$event->setAttribute('BINARY', base64_encode('Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam sollicitudin faucibus mauris amet.'), array('ENCODING' => 'b'));
$ical->addComponent($event);
$this->assertStringEqualsFile(
__DIR__ . '/fixtures/line-folding-1.ics',
$ical->exportVCalendar()
);
$ical = new Horde_Icalendar('1.0');
$event = Horde_Icalendar::newComponent('vevent', $ical);
$event->setAttribute('UID', 'XXX');
$event->setAttribute('DTSTART', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DTSTAMP', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DESCRIPTION', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam sollicitudin faucibus mauris amet.');
$ical->addComponent($event);
$this->assertStringEqualsFile(
__DIR__ . '/fixtures/line-folding-2.ics',
$ical->exportVCalendar()
);
$ical = new Horde_Icalendar();
$event = Horde_Icalendar::newComponent('vevent', $ical);
$event->setAttribute('UID', 'XXX');
$event->setAttribute('DTSTART', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DTSTAMP', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DESCRIPTION', 'Lörem ipsüm dölör sit ämet, cönsectetüer ädipiscing elit. Aliqüäm söllicitüdin fäücibüs mäüris ämet.');
$ical->addComponent($event);
$this->assertStringEqualsFile(
__DIR__ . '/fixtures/line-folding-3.ics',
$ical->exportVCalendar()
);
$ical = new Horde_Icalendar('1.0');
$event = Horde_Icalendar::newComponent('vevent', $ical);
$event->setAttribute('UID', 'XXX');
$event->setAttribute('DTSTART', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DTSTAMP', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DESCRIPTION', 'Lörem ipsüm dölör sit ämet, cönsectetüer ädipiscing elit. Aliqüäm söllicitüdin fäücibüs mäüris ämet.', array('CHARSET' => 'UTF-8'));
$ical->addComponent($event);
$this->assertStringEqualsFile(
__DIR__ . '/fixtures/line-folding-4.ics',
$ical->exportVCalendar()
);
$ical = new Horde_Icalendar('1.0');
$event = Horde_Icalendar::newComponent('vevent', $ical);
$event->setAttribute('UID', 'XXX');
$event->setAttribute('DTSTART', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DTSTAMP', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DESCRIPTION', 'Löremipsümdölörsitämet,cönsectetüerädipiscingelit.Aliqüämsöllicitüdinfäücibüsmäürisämet. Löremipsümdölörsitämet,cönsectetüerädipiscingelit.Aliqüämsöllicitüdinfäücibüsmäürisämet.', array('CHARSET' => 'UTF-8'));
$ical->addComponent($event);
$this->assertStringEqualsFile(
__DIR__ . '/fixtures/line-folding-5.ics',
$ical->exportVCalendar()
);
$ical = new Horde_Icalendar();
$event = Horde_Icalendar::newComponent('vevent', $ical);
$event->setAttribute('UID', 'XXX');
$event->setAttribute('DTSTART', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$event->setAttribute('DTSTAMP', array('year' => 2008, 'month' => 1, 'mday' => 1), array('VALUE' => 'DATE'));
$description = <<<EOT
SYLVIE DAGORNE a écrit :
Bonjour,
suite à mon appel téléphonique auprès de Jacques Benzerara, il m'a renvoyé vers vous. En effet, je souhaiterais vous rencontrer car:
1°) au niveau de l'observatoire local nous devons lancer une enquête sur un suivi de cohorte à la rentrée prochaine qui concernera tous les étudiants de L1. Nous souhaiterons faire un questionnaire en ligne ce questionnaire devra être hébergé sur un serveur.
2°) dans le cadre de l'observatoire régional, nos partenaires nous demande également de faire des questionnaires en ligne. Nous disposons du logiciel Modalisa qui permet de le réaliser mais du point de vu technique, nous avons besoin de voir avec vous, les difficultés et les limites d'un tel dispositif afin de voir les démarches à suivre et pouvoir évoquer tous ces problèmes techniques, je souhaiterais vous rencontrer. Merci de me précisez vos disponibilités?
...
Je serai accompagné d'un collègue pour l'observatoire local (David Le foll) et de la chargée d'études de l'observatoire régional (Amélie Gicquel) pour la partie régionale.
EOT;
$event->setAttribute('DESCRIPTION', $description);
$ical->addComponent($event);
$this->assertStringEqualsFile(
__DIR__ . '/fixtures/line-folding-6.ics',
$ical->exportVCalendar()
);
}
public function testEscapes()
{
$ical = new Horde_Icalendar();
$event1 = Horde_Icalendar::newComponent('vevent', $ical);
$event2 = Horde_Icalendar::newComponent('vevent', $ical);
$event1->setAttribute('UID', '20041120-8550-innerjoin-org');
$event1->setAttribute('DTSTART', array('year' => 2005, 'month' => 5, 'mday' => 3), array('VALUE' => 'DATE'));
$event1->setAttribute('DTSTAMP', array('year' => 2004, 'month' => 11, 'mday' => 20), array('VALUE' => 'DATE'));
$event1->setAttribute('SUMMARY', 'Escaped Comma in Description Field');
$event1->setAttribute('DESCRIPTION', 'There is a comma (escaped with a baskslash) in this sentence and some important words after it, see anything here?');
$event2->setAttribute('UID', '20041120-8549-innerjoin-org');
$event2->setAttribute('DTSTART', array('year' => 2005, 'month' => 5, 'mday' => 4), array('VALUE' => 'DATE'));
$event2->setAttribute('DTSTAMP', array('year' => 2004, 'month' => 11, 'mday' => 20), array('VALUE' => 'DATE'));
$event2->setAttribute('SUMMARY', 'Dash (rather than Comma) in the Description Field');
$event2->setAttribute('DESCRIPTION', 'There are important words after this dash - see anything here or have the words gone?');
$ical->addComponent($event1);
$ical->addComponent($event2);
$this->assertStringEqualsFile(
__DIR__ . '/fixtures/escapes2.ics',
$ical->exportVCalendar()
);
$readIcal = new Horde_Icalendar();
$readIcal->parseVCalendar($ical->exportVCalendar());
$this->assertEquals(
array('There is a comma (escaped with a baskslash) in this sentence and some important words after it, see anything here?'),
$readIcal->getComponent(0)->getAttributeValues('DESCRIPTION')
);
$this->assertEquals(
array('There are important words after this dash - see anything here or have the words gone?'),
$readIcal->getComponent(1)->getAttributeValues('DESCRIPTION')
);
}
public function testQuotedParameters()
{
$ical = new Horde_Icalendar();
$event1 = Horde_Icalendar::newComponent('vevent', $ical);
$event1->setAttribute('UID', '20041120-8550-innerjoin-org');
$event1->setAttribute('DTSTART', array('year' => 2005, 'month' => 5, 'mday' => 3), array('VALUE' => 'DATE'));
$event1->setAttribute('DTSTAMP', array('year' => 2004, 'month' => 11, 'mday' => 20), array('VALUE' => 'DATE'));
$event1->setAttribute('SUMMARY', 'Escaped Comma in Description Field');
$event1->setAttribute('DESCRIPTION', 'There is a comma (escaped with a baskslash) in this sentence and some important words after it, see anything here?');
$event1->setAttribute('ORGANIZER', 'mailto:mueller@example.org', array('CN' => "Klä,rc\"hen;\n Mül:ler"));
$ical->addComponent($event1);
$this->assertStringEqualsFile(
__DIR__ . '/fixtures/quoted-params.ics',
$ical->exportVCalendar()
);
}
public function testTimezone()
{
$date = new Horde_Date(
array(
'year' => 2010,
'month' => 1,
'mday' => 1,
'hour' => 1,
'min' => 0,
'sec' => 0,
),
'UTC'
);
$ical = new Horde_Icalendar();
$event = Horde_Icalendar::newComponent('vevent', $ical);
$event->setAttribute('UID', 'uid');
$event->setAttribute('DTSTAMP', $date);
$event->setAttribute('DTSTART', $date);
$ical->addComponent($event);
$this->assertEquals(
'BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//The Horde Project//Horde iCalendar Library//EN
BEGIN:VEVENT
UID:uid
DTSTAMP:20100101T010000Z
DTSTART:20100101T010000Z
END:VEVENT
END:VCALENDAR
',
$ical->exportVCalendar()
);
$ical = new Horde_Icalendar();
$event = Horde_Icalendar::newComponent('vevent', $ical);
$event->setAttribute('UID', 'uid');
$event->setAttribute('DTSTAMP', $date);
$date->setTimezone('Europe/Berlin');
$event->setAttribute('DTSTART', $date, array('TZID' => 'Europe/Berlin'));
$ical->addComponent($event);
$this->assertEquals(
'BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//The Horde Project//Horde iCalendar Library//EN
BEGIN:VEVENT
UID:uid
DTSTAMP:20100101T010000Z
DTSTART;TZID=Europe/Berlin:20100101T020000
END:VEVENT
END:VCALENDAR
',
$ical->exportVCalendar()
);
}
}
|