2013-04-09 00:54:30 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2013 Thomas Tanghus (thomas@tanghus.net)
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Test_VObject extends PHPUnit_Framework_TestCase {
|
|
|
|
|
|
|
|
public function setUp() {
|
|
|
|
Sabre\VObject\Property::$classMap['SUMMARY'] = 'OC\VObject\StringProperty';
|
2013-05-15 20:56:54 +04:00
|
|
|
Sabre\VObject\Property::$classMap['ORG'] = 'OC\VObject\CompoundProperty';
|
2013-04-09 00:54:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function testStringProperty() {
|
|
|
|
$property = Sabre\VObject\Property::create('SUMMARY', 'Escape;this,please');
|
|
|
|
$this->assertEquals("SUMMARY:Escape\;this\,please\r\n", $property->serialize());
|
|
|
|
}
|
2013-05-15 20:56:54 +04:00
|
|
|
|
|
|
|
function testCompoundProperty() {
|
|
|
|
|
|
|
|
$arr = array(
|
|
|
|
'ABC, Inc.',
|
|
|
|
'North American Division',
|
|
|
|
'Marketing;Sales',
|
|
|
|
);
|
|
|
|
|
|
|
|
$property = Sabre\VObject\Property::create('ORG');
|
|
|
|
$property->setParts($arr);
|
|
|
|
|
|
|
|
$this->assertEquals('ABC\, Inc.;North American Division;Marketing\;Sales', $property->value);
|
|
|
|
$this->assertEquals('ORG:ABC\, Inc.;North American Division;Marketing\;Sales' . "\r\n", $property->serialize());
|
|
|
|
$this->assertEquals(3, count($property->getParts()));
|
|
|
|
$parts = $property->getParts();
|
|
|
|
$this->assertEquals('Marketing;Sales', $parts[2]);
|
|
|
|
}
|
2013-04-09 00:54:30 +04:00
|
|
|
}
|