aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2013-05-15 18:56:54 +0200
committerThomas Tanghus <thomas@tanghus.net>2013-05-15 18:56:54 +0200
commitcb41a30b00ef8d31676989017fa2b9ad416659b9 (patch)
tree2c553f5ab4fc40eb735d32a77f1bfc4284b77b36 /tests
parentfdef2a373a173a81e855982543d64e35723145fa (diff)
downloadnextcloud-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.php19
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