Skip to content

Commit 3f46c2e

Browse files
committed
added binary multivalue read tests with 1/0 values
1 parent dcf379a commit 3f46c2e

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

fixtures/general/base.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@
5353
<sv:value>aDEuIENoYXB0ZXIgMSBUaXRsZQoKKiBmb28KKiBiYXIKKiogZm9vMgoqKiBmb28zCiogZm9vMAoKfHwgaGVhZGVyIHx8IGJhciB8fAp8IGggfCBqIHwKCntjb2RlfQpoZWxsbyB3b3JsZAp7Y29kZX0KCiMgZm9vCg==</sv:value>
5454
<sv:value>aDEuIENoYXB0ZXIgMSBUaXRsZQoKKiBmb28KKiBiYXIKKiogZm9vMgoqKiBmb28zCiogZm9vMAoKfHwgaGVhZGVyIHx8IGJhciB8fAp8IGggfCBqIHwKCntjb2RlfQpoZWxsbyB3b3JsZAp7Y29kZX0KCiMgZm9vCg==</sv:value>
5555
</sv:property>
56+
<sv:property sv:name="single_multidata" sv:type="Binary" sv:multiple="true">
57+
<sv:value></sv:value>
58+
</sv:property>
59+
<sv:property sv:name="empty_multidata" sv:type="Binary" sv:multiple="true">
60+
</sv:property>
5661
<sv:property sv:name="jcr:lastModified" sv:type="Date">
5762
<sv:value>2009-04-27T13:01:07.472+02:00</sv:value>
5863
</sv:property>

tests/Reading/BinaryReadMethodsTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,33 @@ public function testReadBinaryPathTrailingQuestionmark()
146146
$this->assertInternalType('string', $value);
147147
$this->assertEquals($this->decodedstring, $value);
148148
}
149+
150+
/**
151+
* Verifies that we still can read empty data from multivalue binary properties
152+
* @group multitest
153+
*/
154+
public function testReadEmptyBinaryMultivalue()
155+
{
156+
$node = $this->session->getRootNode()->getNode('tests_general_base/index.txt/jcr:content');
157+
$empty = $node->getProperty('empty_multidata');
158+
$this->assertEquals(\PHPCR\PropertyType::BINARY, $empty->getType());
159+
$emptyValue = $empty->getBinary();
160+
$this->assertTrue(is_array($emptyValue));
161+
$this->assertTrue(count($emptyValue) === 0);
162+
}
163+
164+
/**
165+
* Verifies that we still can read empty data from multivalue binary properties
166+
*/
167+
public function testReadSingleBinaryMultivalue()
168+
{
169+
$node = $this->session->getRootNode()->getNode('tests_general_base/index.txt/jcr:content');
170+
$single = $node->getProperty('single_multidata');
171+
$this->assertEquals(\PHPCR\PropertyType::BINARY, $single->getType());
172+
$singleValue = $single->getBinary();
173+
$this->assertTrue(is_array($singleValue));
174+
$this->assertTrue(is_resource($singleValue[0]));
175+
$contents = stream_get_contents($singleValue[0]);
176+
$this->assertEquals('', $contents);
177+
}
149178
}

0 commit comments

Comments
 (0)