diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-05-15 14:34:16 -0700 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-05-15 14:34:16 -0700 |
commit | dfddaf8fbf5ff515f26ff462c7ba6166b3d0ed18 (patch) | |
tree | 5f3d3421062914c4856d75e706f7c356be55af99 /tests | |
parent | 4b3c58c2ca0daa21ce68b2d045c50abc35f60e23 (diff) | |
parent | 990980392c754edac0b4f8325458f1055c7ba0d8 (diff) | |
download | nextcloud-server-dfddaf8fbf5ff515f26ff462c7ba6166b3d0ed18.tar.gz nextcloud-server-dfddaf8fbf5ff515f26ff462c7ba6166b3d0ed18.zip |
Merge pull request #3374 from owncloud/vobject_compound_property
Add Compound property to avoid double escaping values.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/vobject.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/vobject.php b/tests/lib/vobject.php index 1103a4b3297..f28d22a1fcd 100644 --- a/tests/lib/vobject.php +++ b/tests/lib/vobject.php @@ -10,10 +10,29 @@ class Test_VObject extends PHPUnit_Framework_TestCase { public function setUp() { Sabre\VObject\Property::$classMap['SUMMARY'] = 'OC\VObject\StringProperty'; + Sabre\VObject\Property::$classMap['ORG'] = 'OC\VObject\CompoundProperty'; } function testStringProperty() { $property = Sabre\VObject\Property::create('SUMMARY', 'Escape;this,please'); $this->assertEquals("SUMMARY:Escape\;this\,please\r\n", $property->serialize()); } + + 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]); + } }
\ No newline at end of file |