Definition at line 9 of file PropertyTest.php.
◆ testAddParameter()
Sabre\VObject\PropertyTest::testAddParameter |
( |
| ) |
|
Definition at line 212 of file PropertyTest.php.
214 $cal =
new VCalendar();
215 $prop = $cal->createProperty(
'EMAIL');
217 $prop->add(
'MYPARAM',
'value');
219 $this->assertEquals(1, count($prop->parameters()));
220 $this->assertEquals(
'MYPARAM', $prop[
'myparam']->name);
◆ testAddParameterTwice()
Sabre\VObject\PropertyTest::testAddParameterTwice |
( |
| ) |
|
Definition at line 224 of file PropertyTest.php.
226 $cal =
new VCalendar();
227 $prop = $cal->createProperty(
'EMAIL');
229 $prop->add(
'MYPARAM',
'value1');
230 $prop->add(
'MYPARAM',
'value2');
232 $this->assertEquals(1, count($prop->parameters));
233 $this->assertEquals(2, count($prop->parameters[
'MYPARAM']->getParts()));
235 $this->assertEquals(
'MYPARAM', $prop[
'MYPARAM']->name);
◆ testAddScalar()
Sabre\VObject\PropertyTest::testAddScalar |
( |
| ) |
|
Definition at line 197 of file PropertyTest.php.
199 $cal =
new VCalendar();
200 $property = $cal->createProperty(
'EMAIL');
202 $property->add(
'myparam',
'value');
204 $this->assertEquals(1, count($property->parameters()));
206 $this->assertTrue($property->parameters[
'MYPARAM'] instanceof Parameter);
207 $this->assertEquals(
'MYPARAM', $property->parameters[
'MYPARAM']->name);
208 $this->assertEquals(
'value', $property->parameters[
'MYPARAM']->getValue());
◆ testArrayAccessSetInt()
Sabre\VObject\PropertyTest::testArrayAccessSetInt |
( |
| ) |
|
◆ testArrayAccessUnsetInt()
Sabre\VObject\PropertyTest::testArrayAccessUnsetInt |
( |
| ) |
|
◆ testClone()
Sabre\VObject\PropertyTest::testClone |
( |
| ) |
|
Definition at line 240 of file PropertyTest.php.
242 $cal =
new VCalendar();
243 $property = $cal->createProperty(
'EMAIL',
'value');
244 $property[
'FOO'] =
'BAR';
246 $property2 = clone $property;
248 $property[
'FOO'] =
'BAZ';
249 $this->assertEquals(
'BAR', (
string)$property2[
'FOO']);
◆ testCreate()
Sabre\VObject\PropertyTest::testCreate |
( |
| ) |
|
Definition at line 23 of file PropertyTest.php.
References PHPMailer\PHPMailer\$params.
25 $cal =
new VCalendar();
32 $property = $cal->createProperty(
'propname',
'propvalue',
$params);
34 $this->assertEquals(
'value1', $property[
'param1']->getValue());
35 $this->assertEquals(
'value2', $property[
'param2']->getValue());
◆ testCreateParams()
Sabre\VObject\PropertyTest::testCreateParams |
( |
| ) |
|
Definition at line 253 of file PropertyTest.php.
255 $cal =
new VCalendar();
256 $property = $cal->createProperty(
'X-PROP',
'value', [
257 'param1' =>
'value1',
258 'param2' => [
'value2',
'value3']
261 $this->assertEquals(1, count($property[
'PARAM1']->getParts()));
262 $this->assertEquals(2, count($property[
'PARAM2']->getParts()));
◆ testGetIterator()
Sabre\VObject\PropertyTest::testGetIterator |
( |
| ) |
|
Definition at line 176 of file PropertyTest.php.
178 $cal =
new VCalendar();
179 $it =
new ElementList([]);
180 $property = $cal->createProperty(
'propname',
'propvalue');
181 $property->setIterator($it);
182 $this->assertEquals($it, $property->getIterator());
◆ testGetIteratorDefault()
Sabre\VObject\PropertyTest::testGetIteratorDefault |
( |
| ) |
|
Definition at line 187 of file PropertyTest.php.
189 $cal =
new VCalendar();
190 $property = $cal->createProperty(
'propname',
'propvalue');
191 $it = $property->getIterator();
192 $this->assertTrue($it instanceof ElementList);
193 $this->assertEquals(1, count($it));
◆ testGetValue()
Sabre\VObject\PropertyTest::testGetValue |
( |
| ) |
|
Definition at line 311 of file PropertyTest.php.
References $calendar.
314 $property =
$calendar->createProperty(
"SUMMARY", null);
315 $this->assertEquals([], $property->getParts());
316 $this->assertNull($property->getValue());
318 $property->setValue([]);
319 $this->assertEquals([], $property->getParts());
320 $this->assertNull($property->getValue());
322 $property->setValue([1]);
323 $this->assertEquals([1], $property->getParts());
324 $this->assertEquals(1, $property->getValue());
326 $property->setValue([1, 2]);
327 $this->assertEquals([1, 2], $property->getParts());
328 $this->assertEquals(
'1,2', $property->getValue());
330 $property->setValue(
'str');
331 $this->assertEquals([
'str'], $property->getParts());
332 $this->assertEquals(
'str', $property->getValue());
◆ testParameterExists()
Sabre\VObject\PropertyTest::testParameterExists |
( |
| ) |
|
Definition at line 51 of file PropertyTest.php.
53 $cal =
new VCalendar();
54 $property = $cal->createProperty(
'propname',
'propvalue');
55 $property[
'paramname'] =
'paramvalue';
57 $this->assertTrue(isset($property[
'PARAMNAME']));
58 $this->assertTrue(isset($property[
'paramname']));
59 $this->assertFalse(isset($property[
'foo']));
◆ testParameterGet()
Sabre\VObject\PropertyTest::testParameterGet |
( |
| ) |
|
Definition at line 63 of file PropertyTest.php.
65 $cal =
new VCalendar();
66 $property = $cal->createProperty(
'propname',
'propvalue');
67 $property[
'paramname'] =
'paramvalue';
69 $this->assertInstanceOf(
'Sabre\\VObject\\Parameter', $property[
'paramname']);
◆ testParameterMultiple()
Sabre\VObject\PropertyTest::testParameterMultiple |
( |
| ) |
|
Definition at line 83 of file PropertyTest.php.
85 $cal =
new VCalendar();
86 $property = $cal->createProperty(
'propname',
'propvalue');
87 $property[
'paramname'] =
'paramvalue';
88 $property->add(
'paramname',
'paramvalue');
90 $this->assertInstanceOf(
'Sabre\\VObject\\Parameter', $property[
'paramname']);
91 $this->assertEquals(2, count($property[
'paramname']->getParts()));
◆ testParameterNotExists()
Sabre\VObject\PropertyTest::testParameterNotExists |
( |
| ) |
|
Definition at line 73 of file PropertyTest.php.
75 $cal =
new VCalendar();
76 $property = $cal->createProperty(
'propname',
'propvalue');
77 $property[
'paramname'] =
'paramvalue';
79 $this->assertInternalType(
'null', $property[
'foo']);
◆ testSerialize()
Sabre\VObject\PropertyTest::testSerialize |
( |
| ) |
|
Definition at line 119 of file PropertyTest.php.
121 $cal =
new VCalendar();
122 $property = $cal->createProperty(
'propname',
'propvalue');
124 $this->assertEquals(
"PROPNAME:propvalue\r\n", $property->serialize());
◆ testSerializeLongLine()
Sabre\VObject\PropertyTest::testSerializeLongLine |
( |
| ) |
|
Definition at line 149 of file PropertyTest.php.
151 $cal =
new VCalendar();
152 $value = str_repeat(
'!', 200);
153 $property = $cal->createProperty(
'propname', $value);
155 $expected =
"PROPNAME:" . str_repeat(
'!', 66) .
"\r\n " . str_repeat(
'!', 74) .
"\r\n " . str_repeat(
'!', 60) .
"\r\n";
157 $this->assertEquals($expected, $property->serialize());
◆ testSerializeNewLine()
Sabre\VObject\PropertyTest::testSerializeNewLine |
( |
| ) |
|
Definition at line 140 of file PropertyTest.php.
142 $cal =
new VCalendar();
143 $property = $cal->createProperty(
'SUMMARY',
"line1\nline2");
145 $this->assertEquals(
"SUMMARY:line1\\nline2\r\n", $property->serialize());
◆ testSerializeParam()
Sabre\VObject\PropertyTest::testSerializeParam |
( |
| ) |
|
Definition at line 128 of file PropertyTest.php.
130 $cal =
new VCalendar();
131 $property = $cal->createProperty(
'propname',
'propvalue', [
132 'paramname' =>
'paramvalue',
133 'paramname2' =>
'paramvalue2',
136 $this->assertEquals(
"PROPNAME;PARAMNAME=paramvalue;PARAMNAME2=paramvalue2:propvalue\r\n", $property->serialize());
◆ testSerializeUTF8LineFold()
Sabre\VObject\PropertyTest::testSerializeUTF8LineFold |
( |
| ) |
|
Definition at line 161 of file PropertyTest.php.
163 $cal =
new VCalendar();
164 $value = str_repeat(
'!', 65) .
"\xc3\xa4bla" . str_repeat(
'!', 142) .
"\xc3\xa4foo";
165 $property = $cal->createProperty(
'propname', $value);
171 $expected =
"PROPNAME:" . str_repeat(
'!', 65) .
"\r\n \xc3\xa4bla" . str_repeat(
'!', 69) .
"\r\n " . str_repeat(
'!', 73) .
"\r\n \xc3\xa4foo\r\n";
172 $this->assertEquals($expected, $property->serialize());
◆ testSetParameterAsString()
Sabre\VObject\PropertyTest::testSetParameterAsString |
( |
| ) |
|
Definition at line 95 of file PropertyTest.php.
97 $cal =
new VCalendar();
98 $property = $cal->createProperty(
'propname',
'propvalue');
99 $property[
'paramname'] =
'paramvalue';
101 $this->assertEquals(1, count($property->parameters()));
102 $this->assertInstanceOf(
'Sabre\\VObject\\Parameter', $property->parameters[
'PARAMNAME']);
103 $this->assertEquals(
'PARAMNAME', $property->parameters[
'PARAMNAME']->name);
104 $this->assertEquals(
'paramvalue', $property->parameters[
'PARAMNAME']->getValue());
◆ testSetValue()
Sabre\VObject\PropertyTest::testSetValue |
( |
| ) |
|
Definition at line 39 of file PropertyTest.php.
41 $cal =
new VCalendar();
43 $property = $cal->createProperty(
'propname',
'propvalue');
44 $property->setValue(
'value2');
46 $this->assertEquals(
'PROPNAME', $property->name);
47 $this->assertEquals(
'value2', $property->__toString());
◆ testToString()
Sabre\VObject\PropertyTest::testToString |
( |
| ) |
|
Definition at line 11 of file PropertyTest.php.
13 $cal =
new VCalendar();
15 $property = $cal->createProperty(
'propname',
'propvalue');
16 $this->assertEquals(
'PROPNAME', $property->name);
17 $this->assertEquals(
'propvalue', $property->__toString());
18 $this->assertEquals(
'propvalue', (
string)$property);
19 $this->assertEquals(
'propvalue', $property->getValue());
◆ testUnsetParameter()
Sabre\VObject\PropertyTest::testUnsetParameter |
( |
| ) |
|
Definition at line 108 of file PropertyTest.php.
110 $cal =
new VCalendar();
111 $property = $cal->createProperty(
'propname',
'propvalue');
112 $property[
'paramname'] =
'paramvalue';
114 unset($property[
'PARAMNAME']);
115 $this->assertEquals(0, count($property->parameters()));
◆ testValidateBadEncoding()
Sabre\VObject\PropertyTest::testValidateBadEncoding |
( |
| ) |
|
Definition at line 365 of file PropertyTest.php.
References $result.
367 $document =
new VCalendar();
368 $property = $document->add(
'X-FOO',
'value');
369 $property[
'ENCODING'] =
'invalid';
371 $result = $property->validate();
373 $this->assertEquals(
'ENCODING=INVALID is not valid for this document type.',
$result[0][
'message']);
374 $this->assertEquals(3,
$result[0][
'level']);
◆ testValidateBadEncodingVCard21()
Sabre\VObject\PropertyTest::testValidateBadEncodingVCard21 |
( |
| ) |
|
Definition at line 404 of file PropertyTest.php.
References $result.
406 $document =
new VCard([
'VERSION' =>
'2.1']);
407 $property = $document->add(
'X-FOO',
'value');
408 $property[
'ENCODING'] =
'B';
410 $result = $property->validate();
412 $this->assertEquals(
'ENCODING=B is not valid for this document type.',
$result[0][
'message']);
413 $this->assertEquals(3,
$result[0][
'level']);
◆ testValidateBadEncodingVCard3()
Sabre\VObject\PropertyTest::testValidateBadEncodingVCard3 |
( |
| ) |
|
Definition at line 391 of file PropertyTest.php.
References $result.
393 $document =
new VCard([
'VERSION' =>
'3.0']);
394 $property = $document->add(
'X-FOO',
'value');
395 $property[
'ENCODING'] =
'BASE64';
397 $result = $property->validate();
399 $this->assertEquals(
'ENCODING=BASE64 is not valid for this document type.',
$result[0][
'message']);
400 $this->assertEquals(3,
$result[0][
'level']);
◆ testValidateBadEncodingVCard4()
Sabre\VObject\PropertyTest::testValidateBadEncodingVCard4 |
( |
| ) |
|
Definition at line 378 of file PropertyTest.php.
References $result.
380 $document =
new VCard([
'VERSION' =>
'4.0']);
381 $property = $document->add(
'X-FOO',
'value');
382 $property[
'ENCODING'] =
'BASE64';
384 $result = $property->validate();
386 $this->assertEquals(
'ENCODING parameter is not valid in vCard 4.',
$result[0][
'message']);
387 $this->assertEquals(3,
$result[0][
'level']);
◆ testValidateBadPropertyName()
Sabre\VObject\PropertyTest::testValidateBadPropertyName |
( |
| ) |
|
Definition at line 300 of file PropertyTest.php.
References $calendar, $result, and Sabre\VObject\Node\REPAIR.
303 $property =
$calendar->createProperty(
"X_*&PROP*",
"Bla");
306 $this->assertEquals(
$result[0][
'message'],
'The propertyname: X_*&PROP* contains invalid characters. Only A-Z, 0-9 and - are allowed');
307 $this->assertEquals(
'X-PROP', $property->name);
const REPAIR
The following constants are used by the validate() method.
◆ testValidateControlChars()
Sabre\VObject\PropertyTest::testValidateControlChars |
( |
| ) |
|
Definition at line 277 of file PropertyTest.php.
References $c, $calendar, $result, $s, and Sabre\VObject\Node\REPAIR.
281 0x7F, 0x5E, 0x5C, 0x3B, 0x3A, 0x2C, 0x22, 0x20,
282 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18,
283 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
284 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
285 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
287 $s .= sprintf(
'%02X(%c)', $c, $c);
292 $property =
$calendar->createProperty(
'X-PROP',
$s);
295 $this->assertEquals(
'Property contained a control character (0x7f)',
$result[0][
'message']);
296 $this->assertEquals(
"chars[7F()5E(^)5C(\\\\)3B(\\;)3A(:)2C(\\,)22(\")20( )1F()1E()1D()1C()1B()1A()19()18()17()16()15()14()13()12()11()10()0F()0E()0D()0C()0B()0A(\\n)09(\t)08()07()06()05()04()03()02()01()00()]end", $property->getRawMimeDirValue());
const REPAIR
The following constants are used by the validate() method.
◆ testValidateNonUTF8()
Sabre\VObject\PropertyTest::testValidateNonUTF8 |
( |
| ) |
|
Definition at line 266 of file PropertyTest.php.
References $calendar, $result, and Sabre\VObject\Node\REPAIR.
269 $property =
$calendar->createProperty(
'X-PROP',
"Bla\x00");
272 $this->assertEquals(
'Property contained a control character (0x00)',
$result[0][
'message']);
273 $this->assertEquals(
'Bla', $property->getValue());
const REPAIR
The following constants are used by the validate() method.
The documentation for this class was generated from the following file: