diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2013-05-15 18:56:54 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2013-05-15 18:56:54 +0200 |
commit | cb41a30b00ef8d31676989017fa2b9ad416659b9 (patch) | |
tree | 2c553f5ab4fc40eb735d32a77f1bfc4284b77b36 /tests | |
parent | fdef2a373a173a81e855982543d64e35723145fa (diff) | |
download | nextcloud-server-cb41a30b00ef8d31676989017fa2b9ad416659b9.tar.gz nextcloud-server-cb41a30b00ef8d31676989017fa2b9ad416659b9.zip |
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 |