Definition at line 9 of file ComponentTest.php.
◆ ruleData()
Sabre\VObject\ComponentTest::ruleData |
( |
| ) |
|
Definition at line 547 of file ComponentTest.php.
556 [[
'BAR',
'BAZ',
'ZIM',], 0],
557 [[
'BAR',
'BAZ',
'ZIM',
'GIR'], 0],
558 [[
'BAR',
'BAZ',
'ZIM',
'GIR',
'GIR'], 1],
◆ testAddArgFail()
Sabre\VObject\ComponentTest::testAddArgFail |
( |
| ) |
|
InvalidArgumentException
Definition at line 276 of file ComponentTest.php.
278 $comp =
new VCalendar();
279 $comp->add($comp->createComponent(
'VEVENT'),
'hello');
◆ testAddArgFail2()
Sabre\VObject\ComponentTest::testAddArgFail2 |
( |
| ) |
|
InvalidArgumentException
Definition at line 286 of file ComponentTest.php.
288 $comp =
new VCalendar();
◆ testAddComponent()
Sabre\VObject\ComponentTest::testAddComponent |
( |
| ) |
|
Definition at line 248 of file ComponentTest.php.
250 $comp =
new VCalendar([],
false);
252 $comp->add($comp->createComponent(
'VEVENT'));
254 $this->assertEquals(1, count($comp->children()));
256 $this->assertEquals(
'VEVENT', $comp->VEVENT->name);
◆ testAddComponentTwice()
Sabre\VObject\ComponentTest::testAddComponentTwice |
( |
| ) |
|
Definition at line 260 of file ComponentTest.php.
262 $comp =
new VCalendar([],
false);
264 $comp->add($comp->createComponent(
'VEVENT'));
265 $comp->add($comp->createComponent(
'VEVENT'));
267 $this->assertEquals(2, count($comp->children()));
269 $this->assertEquals(
'VEVENT', $comp->VEVENT->name);
◆ testAddScalar()
Sabre\VObject\ComponentTest::testAddScalar |
( |
| ) |
|
Definition at line 210 of file ComponentTest.php.
212 $comp =
new VCalendar([],
false);
214 $comp->add(
'myprop',
'value');
216 $this->assertEquals(1, count($comp->children()));
218 $bla = $comp->children()[0];
220 $this->assertTrue($bla instanceof Property);
221 $this->assertEquals(
'MYPROP', $bla->name);
222 $this->assertEquals(
'value', (
string)$bla);
◆ testAddScalarParams()
Sabre\VObject\ComponentTest::testAddScalarParams |
( |
| ) |
|
Definition at line 226 of file ComponentTest.php.
228 $comp =
new VCalendar([],
false);
230 $comp->add(
'myprop',
'value', [
'param1' =>
'value1']);
232 $this->assertEquals(1, count($comp->children()));
234 $bla = $comp->children()[0];
236 $this->assertInstanceOf(
'Sabre\\VObject\\Property', $bla);
237 $this->assertEquals(
'MYPROP', $bla->name);
238 $this->assertEquals(
'value', (
string)$bla);
240 $this->assertEquals(1, count($bla->parameters()));
242 $this->assertEquals(
'PARAM1', $bla->parameters[
'PARAM1']->name);
243 $this->assertEquals(
'value1', $bla->parameters[
'PARAM1']->getValue());
◆ testAnotherSerializeOrderProp()
Sabre\VObject\ComponentTest::testAnotherSerializeOrderProp |
( |
| ) |
|
Definition at line 374 of file ComponentTest.php.
376 $prop4s = [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10'];
378 $comp =
new VCard([],
false);
380 $comp->__set(
'SOMEPROP',
'FOO');
381 $comp->__set(
'ANOTHERPROP',
'FOO');
382 $comp->__set(
'THIRDPROP',
'FOO');
383 foreach ($prop4s as $prop4) {
384 $comp->add(
'PROP4',
'FOO ' . $prop4);
386 $comp->__set(
'PROPNUMBERFIVE',
'FOO');
387 $comp->__set(
'PROPNUMBERSIX',
'FOO');
388 $comp->__set(
'PROPNUMBERSEVEN',
'FOO');
389 $comp->__set(
'PROPNUMBEREIGHT',
'FOO');
390 $comp->__set(
'PROPNUMBERNINE',
'FOO');
391 $comp->__set(
'PROPNUMBERTEN',
'FOO');
392 $comp->__set(
'VERSION',
'2.0');
393 $comp->__set(
'UID',
'FOO');
395 $str = $comp->serialize();
397 $this->assertEquals(
"BEGIN:VCARD\r\nVERSION:2.0\r\nSOMEPROP:FOO\r\nANOTHERPROP:FOO\r\nTHIRDPROP:FOO\r\nPROP4:FOO 1\r\nPROP4:FOO 2\r\nPROP4:FOO 3\r\nPROP4:FOO 4\r\nPROP4:FOO 5\r\nPROP4:FOO 6\r\nPROP4:FOO 7\r\nPROP4:FOO 8\r\nPROP4:FOO 9\r\nPROP4:FOO 10\r\nPROPNUMBERFIVE:FOO\r\nPROPNUMBERSIX:FOO\r\nPROPNUMBERSEVEN:FOO\r\nPROPNUMBEREIGHT:FOO\r\nPROPNUMBERNINE:FOO\r\nPROPNUMBERTEN:FOO\r\nUID:FOO\r\nEND:VCARD\r\n", $str);
◆ testArrayAccessExists()
Sabre\VObject\ComponentTest::testArrayAccessExists |
( |
| ) |
|
Definition at line 172 of file ComponentTest.php.
174 $comp =
new VCalendar();
176 $event = $comp->createComponent(
'VEVENT');
177 $event->summary =
'Event 1';
181 $event2 = clone $event;
182 $event2->summary =
'Event 2';
186 $this->assertTrue(isset($comp->vevent[0]));
187 $this->assertTrue(isset($comp->vevent[1]));
◆ testArrayAccessGet()
Sabre\VObject\ComponentTest::testArrayAccessGet |
( |
| ) |
|
Definition at line 152 of file ComponentTest.php.
154 $comp =
new VCalendar([],
false);
156 $event = $comp->createComponent(
'VEVENT');
157 $event->summary =
'Event 1';
161 $event2 = clone $event;
162 $event2->summary =
'Event 2';
166 $this->assertEquals(2, count($comp->children()));
167 $this->assertTrue($comp->vevent[1] instanceof
Component);
168 $this->assertEquals(
'Event 2', (
string)$comp->vevent[1]->summary);
◆ testArrayAccessSet()
Sabre\VObject\ComponentTest::testArrayAccessSet |
( |
| ) |
|
LogicException
Definition at line 194 of file ComponentTest.php.
196 $comp =
new VCalendar();
197 $comp[
'hey'] =
'hi there';
◆ testArrayAccessUnset()
Sabre\VObject\ComponentTest::testArrayAccessUnset |
( |
| ) |
|
◆ testChildren()
Sabre\VObject\ComponentTest::testChildren |
( |
| ) |
|
Definition at line 312 of file ComponentTest.php.
References $r.
314 $comp =
new VCalendar([],
false);
317 $comp->add($comp->createComponent(
'VEVENT'));
318 $comp->add($comp->createComponent(
'VTODO'));
320 $r = $comp->children();
321 $this->assertInternalType(
'array',
$r);
322 $this->assertEquals(2, count(
$r));
◆ testCount()
Sabre\VObject\ComponentTest::testCount |
( |
| ) |
|
Definition at line 305 of file ComponentTest.php.
307 $comp =
new VCalendar();
308 $this->assertEquals(1, $comp->count());
◆ testGetComponents()
Sabre\VObject\ComponentTest::testGetComponents |
( |
| ) |
|
Definition at line 325 of file ComponentTest.php.
References $r.
327 $comp =
new VCalendar();
329 $comp->add($comp->createProperty(
'FOO',
'BAR'));
330 $comp->add($comp->createComponent(
'VTODO'));
332 $r = $comp->getComponents();
333 $this->assertInternalType(
'array',
$r);
334 $this->assertEquals(1, count(
$r));
335 $this->assertEquals(
'VTODO',
$r[0]->name);
◆ testInstantiateSubComponent()
Sabre\VObject\ComponentTest::testInstantiateSubComponent |
( |
| ) |
|
Definition at line 413 of file ComponentTest.php.
415 $comp =
new VCalendar();
416 $event = $comp->createComponent(
'VEVENT', [
417 $comp->createProperty(
'UID',
'12345'),
421 $this->assertEquals(
'12345', $comp->VEVENT->UID->getValue());
◆ testInstantiateWithChildren()
Sabre\VObject\ComponentTest::testInstantiateWithChildren |
( |
| ) |
|
Definition at line 401 of file ComponentTest.php.
404 'ORG' => [
'Acme Inc.',
'Section 9'],
405 'FN' =>
'Finn The Human',
408 $this->assertEquals([
'Acme Inc.',
'Section 9'], $comp->ORG->getParts());
409 $this->assertEquals(
'Finn The Human', $comp->FN->getValue());
◆ testIterate()
Sabre\VObject\ComponentTest::testIterate |
( |
| ) |
|
Definition at line 11 of file ComponentTest.php.
References $key.
13 $comp =
new VCalendar([],
false);
15 $sub = $comp->createComponent(
'VEVENT');
18 $sub = $comp->createComponent(
'VTODO');
22 foreach ($comp->children() as
$key => $subcomponent) {
25 $this->assertInstanceOf(
'Sabre\\VObject\\Component', $subcomponent);
28 $this->assertEquals(2, $count);
29 $this->assertEquals(1, $key);
◆ testMagicGet()
Sabre\VObject\ComponentTest::testMagicGet |
( |
| ) |
|
Definition at line 33 of file ComponentTest.php.
35 $comp =
new VCalendar([],
false);
37 $sub = $comp->createComponent(
'VEVENT');
40 $sub = $comp->createComponent(
'VTODO');
43 $event = $comp->vevent;
44 $this->assertInstanceOf(
'Sabre\\VObject\\Component', $event);
45 $this->assertEquals(
'VEVENT', $event->name);
47 $this->assertInternalType(
'null', $comp->vjournal);
◆ testMagicGetGroups()
Sabre\VObject\ComponentTest::testMagicGetGroups |
( |
| ) |
|
Definition at line 51 of file ComponentTest.php.
55 $sub = $comp->createProperty(
'GROUP1.EMAIL',
'1@1.com');
58 $sub = $comp->createProperty(
'GROUP2.EMAIL',
'2@2.com');
61 $sub = $comp->createProperty(
'EMAIL',
'3@3.com');
64 $emails = $comp->email;
65 $this->assertEquals(3, count($emails));
67 $email1 = $comp->{
"group1.email"};
68 $this->assertEquals(
'EMAIL', $email1[0]->name);
69 $this->assertEquals(
'GROUP1', $email1[0]->group);
71 $email3 = $comp->{
".email"};
72 $this->assertEquals(
'EMAIL', $email3[0]->name);
73 $this->assertEquals(null, $email3[0]->group);
◆ testMagicIsset()
Sabre\VObject\ComponentTest::testMagicIsset |
( |
| ) |
|
Definition at line 77 of file ComponentTest.php.
79 $comp =
new VCalendar();
81 $sub = $comp->createComponent(
'VEVENT');
84 $sub = $comp->createComponent(
'VTODO');
87 $this->assertTrue(isset($comp->vevent));
88 $this->assertTrue(isset($comp->vtodo));
89 $this->assertFalse(isset($comp->vjournal));
◆ testMagicSetArray()
Sabre\VObject\ComponentTest::testMagicSetArray |
( |
| ) |
|
Definition at line 116 of file ComponentTest.php.
118 $comp =
new VCalendar();
119 $comp->ORG = [
'Acme Inc',
'Section 9'];
121 $this->assertInstanceOf(
'Sabre\\VObject\\Property', $comp->ORG);
122 $this->assertEquals([
'Acme Inc',
'Section 9'], $comp->ORG->getParts());
◆ testMagicSetComponent()
Sabre\VObject\ComponentTest::testMagicSetComponent |
( |
| ) |
|
Definition at line 126 of file ComponentTest.php.
128 $comp =
new VCalendar();
131 $comp->myProp = $comp->createComponent(
'VEVENT');
133 $this->assertEquals(1, count($comp));
135 $this->assertEquals(
'VEVENT', $comp->VEVENT->name);
◆ testMagicSetScalar()
Sabre\VObject\ComponentTest::testMagicSetScalar |
( |
| ) |
|
Definition at line 93 of file ComponentTest.php.
95 $comp =
new VCalendar();
96 $comp->myProp =
'myValue';
98 $this->assertInstanceOf(
'Sabre\\VObject\\Property', $comp->MYPROP);
99 $this->assertEquals(
'myValue', (
string)$comp->MYPROP);
◆ testMagicSetScalarTwice()
Sabre\VObject\ComponentTest::testMagicSetScalarTwice |
( |
| ) |
|
Definition at line 104 of file ComponentTest.php.
106 $comp =
new VCalendar([],
false);
107 $comp->myProp =
'myValue';
108 $comp->myProp =
'myValue';
110 $this->assertEquals(1, count($comp->children()));
111 $this->assertInstanceOf(
'Sabre\\VObject\\Property', $comp->MYPROP);
112 $this->assertEquals(
'myValue', (
string)$comp->MYPROP);
◆ testMagicSetTwice()
Sabre\VObject\ComponentTest::testMagicSetTwice |
( |
| ) |
|
Definition at line 139 of file ComponentTest.php.
141 $comp =
new VCalendar([],
false);
143 $comp->VEVENT = $comp->createComponent(
'VEVENT');
144 $comp->VEVENT = $comp->createComponent(
'VEVENT');
146 $this->assertEquals(1, count($comp->children()));
148 $this->assertEquals(
'VEVENT', $comp->VEVENT->name);
◆ testMagicUnset()
Sabre\VObject\ComponentTest::testMagicUnset |
( |
| ) |
|
Definition at line 293 of file ComponentTest.php.
295 $comp =
new VCalendar([],
false);
296 $comp->add($comp->createComponent(
'VEVENT'));
298 unset($comp->vevent);
300 $this->assertEquals(0, count($comp->children()));
◆ testRemoveByName()
Sabre\VObject\ComponentTest::testRemoveByName |
( |
| ) |
|
Definition at line 425 of file ComponentTest.php.
427 $comp =
new VCalendar([],
false);
428 $comp->add(
'prop1',
'val1');
429 $comp->add(
'prop2',
'val2');
430 $comp->add(
'prop2',
'val2');
432 $comp->remove(
'prop2');
433 $this->assertFalse(isset($comp->prop2));
434 $this->assertTrue(isset($comp->prop1));
◆ testRemoveByObj()
Sabre\VObject\ComponentTest::testRemoveByObj |
( |
| ) |
|
Definition at line 438 of file ComponentTest.php.
440 $comp =
new VCalendar([],
false);
441 $comp->add(
'prop1',
'val1');
442 $prop = $comp->add(
'prop2',
'val2');
444 $comp->remove($prop);
445 $this->assertFalse(isset($comp->prop2));
446 $this->assertTrue(isset($comp->prop1));
◆ testRemoveNotFound()
Sabre\VObject\ComponentTest::testRemoveNotFound |
( |
| ) |
|
InvalidArgumentException
Definition at line 453 of file ComponentTest.php.
455 $comp =
new VCalendar([],
false);
456 $prop = $comp->createProperty(
'A',
'B');
457 $comp->remove($prop);
◆ testSerialize()
Sabre\VObject\ComponentTest::testSerialize |
( |
| ) |
|
Definition at line 338 of file ComponentTest.php.
340 $comp =
new VCalendar([],
false);
341 $this->assertEquals(
"BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n", $comp->serialize());
◆ testSerializeChildren()
Sabre\VObject\ComponentTest::testSerializeChildren |
( |
| ) |
|
Definition at line 345 of file ComponentTest.php.
347 $comp =
new VCalendar([],
false);
348 $event = $comp->add($comp->createComponent(
'VEVENT'));
349 unset($event->DTSTAMP, $event->UID);
350 $todo = $comp->add($comp->createComponent(
'VTODO'));
351 unset($todo->DTSTAMP, $todo->UID);
353 $str = $comp->serialize();
355 $this->assertEquals(
"BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n", $str);
◆ testSerializeOrderCompAndProp()
Sabre\VObject\ComponentTest::testSerializeOrderCompAndProp |
( |
| ) |
|
Definition at line 359 of file ComponentTest.php.
361 $comp =
new VCalendar([],
false);
362 $comp->add($event = $comp->createComponent(
'VEVENT'));
363 $comp->add(
'PROP1',
'BLABLA');
364 $comp->add(
'VERSION',
'2.0');
365 $comp->add($comp->createComponent(
'VTIMEZONE'));
367 unset($event->DTSTAMP, $event->UID);
368 $str = $comp->serialize();
370 $this->assertEquals(
"BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPROP1:BLABLA\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", $str);
◆ testValidateRepair()
Sabre\VObject\ComponentTest::testValidateRepair |
( |
| ) |
|
Definition at line 477 of file ComponentTest.php.
References Sabre\VObject\Node\REPAIR.
479 $vcard =
new Component\VCard();
481 $component =
new FakeComponent($vcard,
'Hi', [], $defaults =
false);
483 $this->assertEquals(
'yow', $component->BAR->getValue());
const REPAIR
The following constants are used by the validate() method.
◆ testValidateRepairShouldDeduplicatePropertiesWhenValuesAndParametersAreEqual()
Sabre\VObject\ComponentTest::testValidateRepairShouldDeduplicatePropertiesWhenValuesAndParametersAreEqual |
( |
| ) |
|
Definition at line 517 of file ComponentTest.php.
References $messages, and Sabre\VObject\Node\REPAIR.
518 $vcard =
new Component\VCard();
520 $component =
new FakeComponent($vcard,
'WithDuplicateGIR', []);
521 $component->add(
'BAZ',
'BAZ');
522 $component->add(
'GIR',
'VALUE')->add(
'PARAM',
'P');
523 $component->add(
'GIR',
'VALUE')->add(
'PARAM',
'P');
527 $this->assertEquals(1, count(
$messages));
528 $this->assertEquals(1,
$messages[0][
'level']);
529 $this->assertEquals(1, count($component->GIR));
const REPAIR
The following constants are used by the validate() method.
◆ testValidateRepairShouldDeduplicatePropertiesWhenValuesAreEqual()
Sabre\VObject\ComponentTest::testValidateRepairShouldDeduplicatePropertiesWhenValuesAreEqual |
( |
| ) |
|
Definition at line 532 of file ComponentTest.php.
References $messages, and Sabre\VObject\Node\REPAIR.
533 $vcard =
new Component\VCard();
535 $component =
new FakeComponent($vcard,
'WithDuplicateGIR', []);
536 $component->add(
'BAZ',
'BAZ');
537 $component->add(
'GIR',
'VALUE');
538 $component->add(
'GIR',
'VALUE');
542 $this->assertEquals(1, count(
$messages));
543 $this->assertEquals(1,
$messages[0][
'level']);
544 $this->assertEquals(1, count($component->GIR));
const REPAIR
The following constants are used by the validate() method.
◆ testValidateRepairShouldNotDeduplicatePropertiesWhenParametersDiffer()
Sabre\VObject\ComponentTest::testValidateRepairShouldNotDeduplicatePropertiesWhenParametersDiffer |
( |
| ) |
|
Definition at line 502 of file ComponentTest.php.
References $messages, and Sabre\VObject\Node\REPAIR.
503 $vcard =
new Component\VCard();
505 $component =
new FakeComponent($vcard,
'WithDuplicateGIR', []);
506 $component->add(
'BAZ',
'BAZ');
507 $component->add(
'GIR',
'VALUE')->add(
'PARAM',
'1');
508 $component->add(
'GIR',
'VALUE')->add(
'PARAM',
'2');
512 $this->assertEquals(1, count(
$messages));
513 $this->assertEquals(3,
$messages[0][
'level']);
514 $this->assertEquals(2, count($component->GIR));
const REPAIR
The following constants are used by the validate() method.
◆ testValidateRepairShouldNotDeduplicatePropertiesWhenValuesDiffer()
Sabre\VObject\ComponentTest::testValidateRepairShouldNotDeduplicatePropertiesWhenValuesDiffer |
( |
| ) |
|
Definition at line 487 of file ComponentTest.php.
References $messages, and Sabre\VObject\Node\REPAIR.
488 $vcard =
new Component\VCard();
490 $component =
new FakeComponent($vcard,
'WithDuplicateGIR', []);
491 $component->add(
'BAZ',
'BAZ');
492 $component->add(
'GIR',
'VALUE1');
493 $component->add(
'GIR',
'VALUE2');
497 $this->assertEquals(1, count(
$messages));
498 $this->assertEquals(3,
$messages[0][
'level']);
499 $this->assertEquals(2, count($component->GIR));
const REPAIR
The following constants are used by the validate() method.
◆ testValidateRules()
Sabre\VObject\ComponentTest::testValidateRules |
( |
|
$componentList, |
|
|
|
$errorCount |
|
) |
| |
ruleData
Definition at line 464 of file ComponentTest.php.
466 $vcard =
new Component\VCard();
468 $component =
new FakeComponent($vcard,
'Hi', [], $defaults =
false);
469 foreach ($componentList as $v) {
470 $component->add($v,
'Hello.');
473 $this->assertEquals($errorCount, count($component->validate()));
The documentation for this class was generated from the following file: