From ab7a83eda6f1c7b9cb164da9ef6f0d2ccc52e136 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Sat, 6 Dec 2014 16:01:23 +0100 Subject: [PATCH] Add some tests for encoding issues in binary paths --- fixtures/05_Reading/encoding.xml | 10 ++++++++++ fixtures/general/base.xml | 6 ++++++ tests/05_Reading/BinaryReadMethodsTest.php | 20 ++++++++++++++++++++ tests/05_Reading/EncodingTest.php | 2 ++ 4 files changed, 38 insertions(+) diff --git a/fixtures/05_Reading/encoding.xml b/fixtures/05_Reading/encoding.xml index cffc0ee6..1de1b399 100644 --- a/fixtures/05_Reading/encoding.xml +++ b/fixtures/05_Reading/encoding.xml @@ -58,5 +58,15 @@ nt:unstructured + + + nt:unstructured + + + + + nt:unstructured + + diff --git a/fixtures/general/base.xml b/fixtures/general/base.xml index 9da9e31e..a8630964 100644 --- a/fixtures/general/base.xml +++ b/fixtures/general/base.xml @@ -43,6 +43,12 @@ aDEuIENoYXB0ZXIgMSBUaXRsZQoKKiBmb28KKiBiYXIKKiogZm9vMgoqKiBmb28zCiogZm9vMAoKfHwgaGVhZGVyIHx8IGJhciB8fAp8IGggfCBqIHwKCntjb2RlfQpoZWxsbyB3b3JsZAp7Y29kZX0KCiMgZm9vCg== + + aDEuIENoYXB0ZXIgMSBUaXRsZQoKKiBmb28KKiBiYXIKKiogZm9vMgoqKiBmb28zCiogZm9vMAoKfHwgaGVhZGVyIHx8IGJhciB8fAp8IGggfCBqIHwKCntjb2RlfQpoZWxsbyB3b3JsZAp7Y29kZX0KCiMgZm9vCg== + + + aDEuIENoYXB0ZXIgMSBUaXRsZQoKKiBmb28KKiBiYXIKKiogZm9vMgoqKiBmb28zCiogZm9vMAoKfHwgaGVhZGVyIHx8IGJhciB8fAp8IGggfCBqIHwKCntjb2RlfQpoZWxsbyB3b3JsZAp7Y29kZX0KCiMgZm9vCg== + aDEuIENoYXB0ZXIgMSBUaXRsZQoKKiBmb28KKiBiYXIKKiogZm9vMgoqKiBmb28zCiogZm9vMAoKfHwgaGVhZGVyIHx8IGJhciB8fAp8IGggfCBqIHwKCntjb2RlfQpoZWxsbyB3b3JsZAp7Y29kZX0KCiMgZm9vCg== aDEuIENoYXB0ZXIgMSBUaXRsZQoKKiBmb28KKiBiYXIKKiogZm9vMgoqKiBmb28zCiogZm9vMAoKfHwgaGVhZGVyIHx8IGJhciB8fAp8IGggfCBqIHwKCntjb2RlfQpoZWxsbyB3b3JsZAp7Y29kZX0KCiMgZm9vCg== diff --git a/tests/05_Reading/BinaryReadMethodsTest.php b/tests/05_Reading/BinaryReadMethodsTest.php index f787d299..836379be 100644 --- a/tests/05_Reading/BinaryReadMethodsTest.php +++ b/tests/05_Reading/BinaryReadMethodsTest.php @@ -116,4 +116,24 @@ public function testGetLengthMultivalue() $this->assertEquals(strlen($this->decodedstring), $size); } } + + public function testReadBinaryPathEncoding() + { + $node = $this->session->getRootNode()->getNode('tests_general_base/index.txt/jcr:content'); + $binary = $node->getProperty('encoding?%$-test'); + $this->assertEquals(\PHPCR\PropertyType::BINARY, $binary->getType()); + $value = $binary->getString(); + $this->assertInternalType('string', $value); + $this->assertEquals($this->decodedstring, $value); + } + + public function testReadBinaryPathTrailingQuestionmark() + { + $node = $this->session->getRootNode()->getNode('tests_general_base/index.txt/jcr:content'); + $binary = $node->getProperty('encoding?'); + $this->assertEquals(\PHPCR\PropertyType::BINARY, $binary->getType()); + $value = $binary->getString(); + $this->assertInternalType('string', $value); + $this->assertEquals($this->decodedstring, $value); + } } diff --git a/tests/05_Reading/EncodingTest.php b/tests/05_Reading/EncodingTest.php index 8df6a5f3..ee45fd21 100644 --- a/tests/05_Reading/EncodingTest.php +++ b/tests/05_Reading/EncodingTest.php @@ -45,6 +45,8 @@ public static function getNodeNames() array("node- -x"), array("node-ç-x"), array("node-&-x"), + array("node?"), + array("node-¢"), ); } }