1<?php 2 3namespace Sabre\VObject\Property; 4 5use Sabre\VObject\Component\VCard; 6 7class CompoundTest extends \PHPUnit_Framework_TestCase { 8 9 function testSetParts() { 10 11 $arr = array( 12 'ABC, Inc.', 13 'North American Division', 14 'Marketing;Sales', 15 ); 16 17 $vcard = new VCard(); 18 $elem = $vcard->createProperty('ORG'); 19 $elem->setParts($arr); 20 21 $this->assertEquals('ABC\, Inc.;North American Division;Marketing\;Sales', $elem->getValue()); 22 $this->assertEquals(3, count($elem->getParts())); 23 $parts = $elem->getParts(); 24 $this->assertEquals('Marketing;Sales', $parts[2]); 25 26 } 27 28 function testGetParts() { 29 30 $str = 'ABC\, Inc.;North American Division;Marketing\;Sales'; 31 32 $vcard = new VCard(); 33 $elem = $vcard->createProperty('ORG'); 34 $elem->setRawMimeDirValue($str); 35 36 $this->assertEquals(3, count($elem->getParts())); 37 $parts = $elem->getParts(); 38 $this->assertEquals('Marketing;Sales', $parts[2]); 39 } 40 41 function testGetPartsNull() { 42 43 $vcard = new VCard(); 44 $elem = $vcard->createProperty('ORG', null); 45 46 $this->assertEquals(0, count($elem->getParts())); 47 48 } 49 50} 51