Mercurial > hg > rc1
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 6:cec75ba50afc | 7:430dbd5346f7 |
|---|---|
| 1 <?php | |
| 2 | |
| 3 namespace Sabre\VObject\Property; | |
| 4 | |
| 5 use Sabre\VObject\Component\VCard; | |
| 6 | |
| 7 class 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 } |
