You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
<?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()));
|
|
|
|
}
|
|
|
|
}
|
|
|