ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\ComponentTest Class Reference
+ Inheritance diagram for Sabre\VObject\ComponentTest:
+ Collaboration diagram for Sabre\VObject\ComponentTest:

Public Member Functions

 testIterate ()
 
 testMagicGet ()
 
 testMagicGetGroups ()
 
 testMagicIsset ()
 
 testMagicSetScalar ()
 
 testMagicSetScalarTwice ()
 
 testMagicSetArray ()
 
 testMagicSetComponent ()
 
 testMagicSetTwice ()
 
 testArrayAccessGet ()
 
 testArrayAccessExists ()
 
 testArrayAccessSet ()
 LogicException More...
 
 testArrayAccessUnset ()
 LogicException More...
 
 testAddScalar ()
 
 testAddScalarParams ()
 
 testAddComponent ()
 
 testAddComponentTwice ()
 
 testAddArgFail ()
 InvalidArgumentException More...
 
 testAddArgFail2 ()
 InvalidArgumentException More...
 
 testMagicUnset ()
 
 testCount ()
 
 testChildren ()
 
 testGetComponents ()
 
 testSerialize ()
 
 testSerializeChildren ()
 
 testSerializeOrderCompAndProp ()
 
 testAnotherSerializeOrderProp ()
 
 testInstantiateWithChildren ()
 
 testInstantiateSubComponent ()
 
 testRemoveByName ()
 
 testRemoveByObj ()
 
 testRemoveNotFound ()
 InvalidArgumentException More...
 
 testValidateRules ($componentList, $errorCount)
 ruleData More...
 
 testValidateRepair ()
 
 testValidateRepairShouldNotDeduplicatePropertiesWhenValuesDiffer ()
 
 testValidateRepairShouldNotDeduplicatePropertiesWhenParametersDiffer ()
 
 testValidateRepairShouldDeduplicatePropertiesWhenValuesAndParametersAreEqual ()
 
 testValidateRepairShouldDeduplicatePropertiesWhenValuesAreEqual ()
 
 ruleData ()
 

Detailed Description

Definition at line 9 of file ComponentTest.php.

Member Function Documentation

◆ ruleData()

Sabre\VObject\ComponentTest::ruleData ( )

Definition at line 547 of file ComponentTest.php.

547  {
548 
549  return [
550 
551  [[], 2],
552  [['FOO'], 3],
553  [['BAR'], 1],
554  [['BAZ'], 1],
555  [['BAR','BAZ'], 0],
556  [['BAR','BAZ','ZIM',], 0],
557  [['BAR','BAZ','ZIM','GIR'], 0],
558  [['BAR','BAZ','ZIM','GIR','GIR'], 1],
559 
560  ];
561 
562  }

◆ testAddArgFail()

Sabre\VObject\ComponentTest::testAddArgFail ( )

InvalidArgumentException

Definition at line 276 of file ComponentTest.php.

276  {
277 
278  $comp = new VCalendar();
279  $comp->add($comp->createComponent('VEVENT'), 'hello');
280 
281  }

◆ testAddArgFail2()

Sabre\VObject\ComponentTest::testAddArgFail2 ( )

InvalidArgumentException

Definition at line 286 of file ComponentTest.php.

286  {
287 
288  $comp = new VCalendar();
289  $comp->add([]);
290 
291  }

◆ testAddComponent()

Sabre\VObject\ComponentTest::testAddComponent ( )

Definition at line 248 of file ComponentTest.php.

248  {
249 
250  $comp = new VCalendar([], false);
251 
252  $comp->add($comp->createComponent('VEVENT'));
253 
254  $this->assertEquals(1, count($comp->children()));
255 
256  $this->assertEquals('VEVENT', $comp->VEVENT->name);
257 
258  }

◆ testAddComponentTwice()

Sabre\VObject\ComponentTest::testAddComponentTwice ( )

Definition at line 260 of file ComponentTest.php.

260  {
261 
262  $comp = new VCalendar([], false);
263 
264  $comp->add($comp->createComponent('VEVENT'));
265  $comp->add($comp->createComponent('VEVENT'));
266 
267  $this->assertEquals(2, count($comp->children()));
268 
269  $this->assertEquals('VEVENT', $comp->VEVENT->name);
270 
271  }

◆ testAddScalar()

Sabre\VObject\ComponentTest::testAddScalar ( )

Definition at line 210 of file ComponentTest.php.

210  {
211 
212  $comp = new VCalendar([], false);
213 
214  $comp->add('myprop', 'value');
215 
216  $this->assertEquals(1, count($comp->children()));
217 
218  $bla = $comp->children()[0];
219 
220  $this->assertTrue($bla instanceof Property);
221  $this->assertEquals('MYPROP', $bla->name);
222  $this->assertEquals('value', (string)$bla);
223 
224  }

◆ testAddScalarParams()

Sabre\VObject\ComponentTest::testAddScalarParams ( )

Definition at line 226 of file ComponentTest.php.

226  {
227 
228  $comp = new VCalendar([], false);
229 
230  $comp->add('myprop', 'value', ['param1' => 'value1']);
231 
232  $this->assertEquals(1, count($comp->children()));
233 
234  $bla = $comp->children()[0];
235 
236  $this->assertInstanceOf('Sabre\\VObject\\Property', $bla);
237  $this->assertEquals('MYPROP', $bla->name);
238  $this->assertEquals('value', (string)$bla);
239 
240  $this->assertEquals(1, count($bla->parameters()));
241 
242  $this->assertEquals('PARAM1', $bla->parameters['PARAM1']->name);
243  $this->assertEquals('value1', $bla->parameters['PARAM1']->getValue());
244 
245  }

◆ testAnotherSerializeOrderProp()

Sabre\VObject\ComponentTest::testAnotherSerializeOrderProp ( )

Definition at line 374 of file ComponentTest.php.

374  {
375 
376  $prop4s = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
377 
378  $comp = new VCard([], false);
379 
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);
385  }
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');
394 
395  $str = $comp->serialize();
396 
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);
398 
399  }

◆ testArrayAccessExists()

Sabre\VObject\ComponentTest::testArrayAccessExists ( )

Definition at line 172 of file ComponentTest.php.

172  {
173 
174  $comp = new VCalendar();
175 
176  $event = $comp->createComponent('VEVENT');
177  $event->summary = 'Event 1';
178 
179  $comp->add($event);
180 
181  $event2 = clone $event;
182  $event2->summary = 'Event 2';
183 
184  $comp->add($event2);
185 
186  $this->assertTrue(isset($comp->vevent[0]));
187  $this->assertTrue(isset($comp->vevent[1]));
188 
189  }

◆ testArrayAccessGet()

Sabre\VObject\ComponentTest::testArrayAccessGet ( )

Definition at line 152 of file ComponentTest.php.

152  {
153 
154  $comp = new VCalendar([], false);
155 
156  $event = $comp->createComponent('VEVENT');
157  $event->summary = 'Event 1';
158 
159  $comp->add($event);
160 
161  $event2 = clone $event;
162  $event2->summary = 'Event 2';
163 
164  $comp->add($event2);
165 
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);
169 
170  }

◆ testArrayAccessSet()

Sabre\VObject\ComponentTest::testArrayAccessSet ( )

LogicException

Definition at line 194 of file ComponentTest.php.

194  {
195 
196  $comp = new VCalendar();
197  $comp['hey'] = 'hi there';
198 
199  }

◆ testArrayAccessUnset()

Sabre\VObject\ComponentTest::testArrayAccessUnset ( )

LogicException

Definition at line 203 of file ComponentTest.php.

203  {
204 
205  $comp = new VCalendar();
206  unset($comp[0]);
207 
208  }

◆ testChildren()

Sabre\VObject\ComponentTest::testChildren ( )

Definition at line 312 of file ComponentTest.php.

References $r.

312  {
313 
314  $comp = new VCalendar([], false);
315 
316  // Note that 'myProp' is ignored here.
317  $comp->add($comp->createComponent('VEVENT'));
318  $comp->add($comp->createComponent('VTODO'));
319 
320  $r = $comp->children();
321  $this->assertInternalType('array', $r);
322  $this->assertEquals(2, count($r));
323  }
$r
Definition: example_031.php:79

◆ testCount()

Sabre\VObject\ComponentTest::testCount ( )

Definition at line 305 of file ComponentTest.php.

305  {
306 
307  $comp = new VCalendar();
308  $this->assertEquals(1, $comp->count());
309 
310  }

◆ testGetComponents()

Sabre\VObject\ComponentTest::testGetComponents ( )

Definition at line 325 of file ComponentTest.php.

References $r.

325  {
326 
327  $comp = new VCalendar();
328 
329  $comp->add($comp->createProperty('FOO', 'BAR'));
330  $comp->add($comp->createComponent('VTODO'));
331 
332  $r = $comp->getComponents();
333  $this->assertInternalType('array', $r);
334  $this->assertEquals(1, count($r));
335  $this->assertEquals('VTODO', $r[0]->name);
336  }
$r
Definition: example_031.php:79

◆ testInstantiateSubComponent()

Sabre\VObject\ComponentTest::testInstantiateSubComponent ( )

Definition at line 413 of file ComponentTest.php.

413  {
414 
415  $comp = new VCalendar();
416  $event = $comp->createComponent('VEVENT', [
417  $comp->createProperty('UID', '12345'),
418  ]);
419  $comp->add($event);
420 
421  $this->assertEquals('12345', $comp->VEVENT->UID->getValue());
422 
423  }

◆ testInstantiateWithChildren()

Sabre\VObject\ComponentTest::testInstantiateWithChildren ( )

Definition at line 401 of file ComponentTest.php.

401  {
402 
403  $comp = new VCard([
404  'ORG' => ['Acme Inc.', 'Section 9'],
405  'FN' => 'Finn The Human',
406  ]);
407 
408  $this->assertEquals(['Acme Inc.', 'Section 9'], $comp->ORG->getParts());
409  $this->assertEquals('Finn The Human', $comp->FN->getValue());
410 
411  }

◆ testIterate()

Sabre\VObject\ComponentTest::testIterate ( )

Definition at line 11 of file ComponentTest.php.

References $key.

11  {
12 
13  $comp = new VCalendar([], false);
14 
15  $sub = $comp->createComponent('VEVENT');
16  $comp->add($sub);
17 
18  $sub = $comp->createComponent('VTODO');
19  $comp->add($sub);
20 
21  $count = 0;
22  foreach ($comp->children() as $key => $subcomponent) {
23 
24  $count++;
25  $this->assertInstanceOf('Sabre\\VObject\\Component', $subcomponent);
26 
27  }
28  $this->assertEquals(2, $count);
29  $this->assertEquals(1, $key);
30 
31  }
$key
Definition: croninfo.php:18

◆ testMagicGet()

Sabre\VObject\ComponentTest::testMagicGet ( )

Definition at line 33 of file ComponentTest.php.

33  {
34 
35  $comp = new VCalendar([], false);
36 
37  $sub = $comp->createComponent('VEVENT');
38  $comp->add($sub);
39 
40  $sub = $comp->createComponent('VTODO');
41  $comp->add($sub);
42 
43  $event = $comp->vevent;
44  $this->assertInstanceOf('Sabre\\VObject\\Component', $event);
45  $this->assertEquals('VEVENT', $event->name);
46 
47  $this->assertInternalType('null', $comp->vjournal);
48 
49  }

◆ testMagicGetGroups()

Sabre\VObject\ComponentTest::testMagicGetGroups ( )

Definition at line 51 of file ComponentTest.php.

51  {
52 
53  $comp = new VCard();
54 
55  $sub = $comp->createProperty('GROUP1.EMAIL', '1@1.com');
56  $comp->add($sub);
57 
58  $sub = $comp->createProperty('GROUP2.EMAIL', '2@2.com');
59  $comp->add($sub);
60 
61  $sub = $comp->createProperty('EMAIL', '3@3.com');
62  $comp->add($sub);
63 
64  $emails = $comp->email;
65  $this->assertEquals(3, count($emails));
66 
67  $email1 = $comp->{"group1.email"};
68  $this->assertEquals('EMAIL', $email1[0]->name);
69  $this->assertEquals('GROUP1', $email1[0]->group);
70 
71  $email3 = $comp->{".email"};
72  $this->assertEquals('EMAIL', $email3[0]->name);
73  $this->assertEquals(null, $email3[0]->group);
74 
75  }

◆ testMagicIsset()

Sabre\VObject\ComponentTest::testMagicIsset ( )

Definition at line 77 of file ComponentTest.php.

77  {
78 
79  $comp = new VCalendar();
80 
81  $sub = $comp->createComponent('VEVENT');
82  $comp->add($sub);
83 
84  $sub = $comp->createComponent('VTODO');
85  $comp->add($sub);
86 
87  $this->assertTrue(isset($comp->vevent));
88  $this->assertTrue(isset($comp->vtodo));
89  $this->assertFalse(isset($comp->vjournal));
90 
91  }

◆ testMagicSetArray()

Sabre\VObject\ComponentTest::testMagicSetArray ( )

Definition at line 116 of file ComponentTest.php.

116  {
117 
118  $comp = new VCalendar();
119  $comp->ORG = ['Acme Inc', 'Section 9'];
120 
121  $this->assertInstanceOf('Sabre\\VObject\\Property', $comp->ORG);
122  $this->assertEquals(['Acme Inc', 'Section 9'], $comp->ORG->getParts());
123 
124  }

◆ testMagicSetComponent()

Sabre\VObject\ComponentTest::testMagicSetComponent ( )

Definition at line 126 of file ComponentTest.php.

126  {
127 
128  $comp = new VCalendar();
129 
130  // Note that 'myProp' is ignored here.
131  $comp->myProp = $comp->createComponent('VEVENT');
132 
133  $this->assertEquals(1, count($comp));
134 
135  $this->assertEquals('VEVENT', $comp->VEVENT->name);
136 
137  }

◆ testMagicSetScalar()

Sabre\VObject\ComponentTest::testMagicSetScalar ( )

Definition at line 93 of file ComponentTest.php.

93  {
94 
95  $comp = new VCalendar();
96  $comp->myProp = 'myValue';
97 
98  $this->assertInstanceOf('Sabre\\VObject\\Property', $comp->MYPROP);
99  $this->assertEquals('myValue', (string)$comp->MYPROP);
100 
101 
102  }

◆ testMagicSetScalarTwice()

Sabre\VObject\ComponentTest::testMagicSetScalarTwice ( )

Definition at line 104 of file ComponentTest.php.

104  {
105 
106  $comp = new VCalendar([], false);
107  $comp->myProp = 'myValue';
108  $comp->myProp = 'myValue';
109 
110  $this->assertEquals(1, count($comp->children()));
111  $this->assertInstanceOf('Sabre\\VObject\\Property', $comp->MYPROP);
112  $this->assertEquals('myValue', (string)$comp->MYPROP);
113 
114  }

◆ testMagicSetTwice()

Sabre\VObject\ComponentTest::testMagicSetTwice ( )

Definition at line 139 of file ComponentTest.php.

139  {
140 
141  $comp = new VCalendar([], false);
142 
143  $comp->VEVENT = $comp->createComponent('VEVENT');
144  $comp->VEVENT = $comp->createComponent('VEVENT');
145 
146  $this->assertEquals(1, count($comp->children()));
147 
148  $this->assertEquals('VEVENT', $comp->VEVENT->name);
149 
150  }

◆ testMagicUnset()

Sabre\VObject\ComponentTest::testMagicUnset ( )

Definition at line 293 of file ComponentTest.php.

293  {
294 
295  $comp = new VCalendar([], false);
296  $comp->add($comp->createComponent('VEVENT'));
297 
298  unset($comp->vevent);
299 
300  $this->assertEquals(0, count($comp->children()));
301 
302  }

◆ testRemoveByName()

Sabre\VObject\ComponentTest::testRemoveByName ( )

Definition at line 425 of file ComponentTest.php.

425  {
426 
427  $comp = new VCalendar([], false);
428  $comp->add('prop1', 'val1');
429  $comp->add('prop2', 'val2');
430  $comp->add('prop2', 'val2');
431 
432  $comp->remove('prop2');
433  $this->assertFalse(isset($comp->prop2));
434  $this->assertTrue(isset($comp->prop1));
435 
436  }

◆ testRemoveByObj()

Sabre\VObject\ComponentTest::testRemoveByObj ( )

Definition at line 438 of file ComponentTest.php.

438  {
439 
440  $comp = new VCalendar([], false);
441  $comp->add('prop1', 'val1');
442  $prop = $comp->add('prop2', 'val2');
443 
444  $comp->remove($prop);
445  $this->assertFalse(isset($comp->prop2));
446  $this->assertTrue(isset($comp->prop1));
447 
448  }

◆ testRemoveNotFound()

Sabre\VObject\ComponentTest::testRemoveNotFound ( )

InvalidArgumentException

Definition at line 453 of file ComponentTest.php.

453  {
454 
455  $comp = new VCalendar([], false);
456  $prop = $comp->createProperty('A', 'B');
457  $comp->remove($prop);
458 
459  }

◆ testSerialize()

Sabre\VObject\ComponentTest::testSerialize ( )

Definition at line 338 of file ComponentTest.php.

338  {
339 
340  $comp = new VCalendar([], false);
341  $this->assertEquals("BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n", $comp->serialize());
342 
343  }

◆ testSerializeChildren()

Sabre\VObject\ComponentTest::testSerializeChildren ( )

Definition at line 345 of file ComponentTest.php.

345  {
346 
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);
352 
353  $str = $comp->serialize();
354 
355  $this->assertEquals("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n", $str);
356 
357  }

◆ testSerializeOrderCompAndProp()

Sabre\VObject\ComponentTest::testSerializeOrderCompAndProp ( )

Definition at line 359 of file ComponentTest.php.

359  {
360 
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'));
366 
367  unset($event->DTSTAMP, $event->UID);
368  $str = $comp->serialize();
369 
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);
371 
372  }

◆ testValidateRepair()

Sabre\VObject\ComponentTest::testValidateRepair ( )

Definition at line 477 of file ComponentTest.php.

References Sabre\VObject\Node\REPAIR.

477  {
478 
479  $vcard = new Component\VCard();
480 
481  $component = new FakeComponent($vcard, 'Hi', [], $defaults = false);
482  $component->validate(Component::REPAIR);
483  $this->assertEquals('yow', $component->BAR->getValue());
484 
485  }
const REPAIR
The following constants are used by the validate() method.
Definition: Node.php:27

◆ testValidateRepairShouldDeduplicatePropertiesWhenValuesAndParametersAreEqual()

Sabre\VObject\ComponentTest::testValidateRepairShouldDeduplicatePropertiesWhenValuesAndParametersAreEqual ( )

Definition at line 517 of file ComponentTest.php.

References $messages, and Sabre\VObject\Node\REPAIR.

517  {
518  $vcard = new Component\VCard();
519 
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');
524 
525  $messages = $component->validate(Component::REPAIR);
526 
527  $this->assertEquals(1, count($messages));
528  $this->assertEquals(1, $messages[0]['level']);
529  $this->assertEquals(1, count($component->GIR));
530  }
$messages
Definition: en.php:5
const REPAIR
The following constants are used by the validate() method.
Definition: Node.php:27

◆ testValidateRepairShouldDeduplicatePropertiesWhenValuesAreEqual()

Sabre\VObject\ComponentTest::testValidateRepairShouldDeduplicatePropertiesWhenValuesAreEqual ( )

Definition at line 532 of file ComponentTest.php.

References $messages, and Sabre\VObject\Node\REPAIR.

532  {
533  $vcard = new Component\VCard();
534 
535  $component = new FakeComponent($vcard, 'WithDuplicateGIR', []);
536  $component->add('BAZ', 'BAZ');
537  $component->add('GIR', 'VALUE');
538  $component->add('GIR', 'VALUE');
539 
540  $messages = $component->validate(Component::REPAIR);
541 
542  $this->assertEquals(1, count($messages));
543  $this->assertEquals(1, $messages[0]['level']);
544  $this->assertEquals(1, count($component->GIR));
545  }
$messages
Definition: en.php:5
const REPAIR
The following constants are used by the validate() method.
Definition: Node.php:27

◆ testValidateRepairShouldNotDeduplicatePropertiesWhenParametersDiffer()

Sabre\VObject\ComponentTest::testValidateRepairShouldNotDeduplicatePropertiesWhenParametersDiffer ( )

Definition at line 502 of file ComponentTest.php.

References $messages, and Sabre\VObject\Node\REPAIR.

502  {
503  $vcard = new Component\VCard();
504 
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'); // Same value but different parameters
509 
510  $messages = $component->validate(Component::REPAIR);
511 
512  $this->assertEquals(1, count($messages));
513  $this->assertEquals(3, $messages[0]['level']);
514  $this->assertEquals(2, count($component->GIR));
515  }
$messages
Definition: en.php:5
const REPAIR
The following constants are used by the validate() method.
Definition: Node.php:27

◆ testValidateRepairShouldNotDeduplicatePropertiesWhenValuesDiffer()

Sabre\VObject\ComponentTest::testValidateRepairShouldNotDeduplicatePropertiesWhenValuesDiffer ( )

Definition at line 487 of file ComponentTest.php.

References $messages, and Sabre\VObject\Node\REPAIR.

487  {
488  $vcard = new Component\VCard();
489 
490  $component = new FakeComponent($vcard, 'WithDuplicateGIR', []);
491  $component->add('BAZ', 'BAZ');
492  $component->add('GIR', 'VALUE1');
493  $component->add('GIR', 'VALUE2'); // Different values
494 
495  $messages = $component->validate(Component::REPAIR);
496 
497  $this->assertEquals(1, count($messages));
498  $this->assertEquals(3, $messages[0]['level']);
499  $this->assertEquals(2, count($component->GIR));
500  }
$messages
Definition: en.php:5
const REPAIR
The following constants are used by the validate() method.
Definition: Node.php:27

◆ testValidateRules()

Sabre\VObject\ComponentTest::testValidateRules (   $componentList,
  $errorCount 
)

ruleData

Definition at line 464 of file ComponentTest.php.

464  {
465 
466  $vcard = new Component\VCard();
467 
468  $component = new FakeComponent($vcard, 'Hi', [], $defaults = false);
469  foreach ($componentList as $v) {
470  $component->add($v, 'Hello.');
471  }
472 
473  $this->assertEquals($errorCount, count($component->validate()));
474 
475  }

The documentation for this class was generated from the following file: