11 $cal =
new Component\VCalendar();
13 $param =
new Parameter($cal,
'name',
'value');
14 $this->assertEquals(
'NAME', $param->name);
15 $this->assertEquals(
'value', $param->getValue());
21 $card =
new Component\VCard();
23 $param =
new Parameter($card, null,
'URL');
24 $this->assertEquals(
'VALUE', $param->name);
25 $this->assertEquals(
'URL', $param->getValue());
26 $this->assertTrue($param->noName);
32 $cal =
new Component\VCalendar();
34 $param =
new Parameter($cal,
'name', null);
36 $this->assertEquals([1], $param->getParts());
38 $param->setParts([1, 2]);
39 $this->assertEquals([1, 2], $param->getParts());
42 $this->assertEquals([1, 2, 3], $param->getParts());
46 $this->assertEquals([4, 5], $param->getParts());
52 $cal =
new Component\VCalendar();
53 $param =
new Parameter($cal,
'name',
'value');
54 $this->assertEquals(
'value', $param->__toString());
55 $this->assertEquals(
'value', (
string)$param);
61 $cal =
new Component\VCalendar();
62 $param =
new Parameter($cal,
'name', null);
63 $this->assertEquals(
'', $param->__toString());
64 $this->assertEquals(
'', (
string)$param);
70 $cal =
new Component\VCalendar();
71 $param =
new Parameter($cal,
'name',
'value');
72 $this->assertEquals(
'NAME=value', $param->serialize());
78 $cal =
new Component\VCalendar();
79 $param =
new Parameter($cal,
'name', null);
80 $this->assertEquals(
'NAME=', $param->serialize());
86 $cal =
new Component\VCalendar();
87 $param =
new Parameter($cal,
'name', [
"val1",
"val2;",
"val3^",
"val4\n",
"val5\""]);
88 $this->assertEquals(
'NAME=val1,"val2;","val3^^","val4^n","val5^\'"', $param->serialize());
100 $cal =
new Component\VCalendar();
101 $param =
new Parameter($cal,
'EMAIL',
"user+something@example.org");
102 $this->assertEquals(
'EMAIL="user+something@example.org"', $param->serialize());
108 $cal =
new Component\VCalendar();
110 $param =
new Parameter($cal,
'name', [1, 2, 3, 4]);
113 foreach ($param as $value) {
117 $this->assertEquals([1, 2, 3, 4],
$result);
123 $cal =
new Component\VCalendar();
124 $param =
new Parameter($cal,
'name',
'va:lue');
125 $this->assertEquals(
'NAME="va:lue"', $param->serialize());
131 $cal =
new Component\VCalendar();
132 $param =
new Parameter($cal,
'name',
'va;lue');
133 $this->assertEquals(
'NAME="va;lue"', $param->serialize());
testSerializePlusSign()
iCal 7.0 (OSX 10.9) has major issues with the EMAIL property, when the value contains a plus sign...