Mercurial > hg > rc1
diff vendor/sabre/vobject/tests/VObject/Property/CompoundTest.php @ 7:430dbd5346f7
vendor sabre as distributed
author | Charlie Root |
---|---|
date | Sat, 13 Jan 2018 09:06:10 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/sabre/vobject/tests/VObject/Property/CompoundTest.php Sat Jan 13 09:06:10 2018 -0500 @@ -0,0 +1,50 @@ +<?php + +namespace Sabre\VObject\Property; + +use Sabre\VObject\Component\VCard; + +class CompoundTest extends \PHPUnit_Framework_TestCase { + + function testSetParts() { + + $arr = array( + 'ABC, Inc.', + 'North American Division', + 'Marketing;Sales', + ); + + $vcard = new VCard(); + $elem = $vcard->createProperty('ORG'); + $elem->setParts($arr); + + $this->assertEquals('ABC\, Inc.;North American Division;Marketing\;Sales', $elem->getValue()); + $this->assertEquals(3, count($elem->getParts())); + $parts = $elem->getParts(); + $this->assertEquals('Marketing;Sales', $parts[2]); + + } + + function testGetParts() { + + $str = 'ABC\, Inc.;North American Division;Marketing\;Sales'; + + $vcard = new VCard(); + $elem = $vcard->createProperty('ORG'); + $elem->setRawMimeDirValue($str); + + $this->assertEquals(3, count($elem->getParts())); + $parts = $elem->getParts(); + $this->assertEquals('Marketing;Sales', $parts[2]); + } + + function testGetPartsNull() { + + $vcard = new VCard(); + $elem = $vcard->createProperty('ORG', null); + + $this->assertEquals(0, count($elem->getParts())); + + } + +}