ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
CompoundTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\VObject\Property;
4 
7 
8 class CompoundTest extends TestCase {
9 
10  function testSetParts() {
11 
12  $arr = [
13  'ABC, Inc.',
14  'North American Division',
15  'Marketing;Sales',
16  ];
17 
18  $vcard = new VCard();
19  $elem = $vcard->createProperty('ORG');
20  $elem->setParts($arr);
21 
22  $this->assertEquals('ABC\, Inc.;North American Division;Marketing\;Sales', $elem->getValue());
23  $this->assertEquals(3, count($elem->getParts()));
24  $parts = $elem->getParts();
25  $this->assertEquals('Marketing;Sales', $parts[2]);
26 
27  }
28 
29  function testGetParts() {
30 
31  $str = 'ABC\, Inc.;North American Division;Marketing\;Sales';
32 
33  $vcard = new VCard();
34  $elem = $vcard->createProperty('ORG');
35  $elem->setRawMimeDirValue($str);
36 
37  $this->assertEquals(3, count($elem->getParts()));
38  $parts = $elem->getParts();
39  $this->assertEquals('Marketing;Sales', $parts[2]);
40  }
41 
42  function testGetPartsNull() {
43 
44  $vcard = new VCard();
45  $elem = $vcard->createProperty('ORG', null);
46 
47  $this->assertEquals(0, count($elem->getParts()));
48 
49  }
50 
51 }
count()
Returns the number of elements.
Definition: Node.php:177
The VCard component.
Definition: VCard.php:18