diff --git a/tests/05_Reading/BinaryReadMethodsTest.php b/tests/05_Reading/BinaryReadMethodsTest.php index 836379be..dc3ddecf 100644 --- a/tests/05_Reading/BinaryReadMethodsTest.php +++ b/tests/05_Reading/BinaryReadMethodsTest.php @@ -75,6 +75,7 @@ public function testReadBinaryValueAsString() public function testGetLength() { $size = $this->binaryProperty->getLength(); + $this->assertInternalType('integer', $size); $this->assertEquals(strlen($this->decodedstring), $size); } @@ -113,6 +114,7 @@ public function testGetLengthMultivalue() $sizes = $binaryMulti->getLength(); $this->assertInternalType('array', $sizes); foreach ($sizes as $size) { + $this->assertInternalType('integer', $size); $this->assertEquals(strlen($this->decodedstring), $size); } } diff --git a/tests/10_Writing/SetPropertyMethodsTest.php b/tests/10_Writing/SetPropertyMethodsTest.php index 26fe5dc3..e55faa75 100644 --- a/tests/10_Writing/SetPropertyMethodsTest.php +++ b/tests/10_Writing/SetPropertyMethodsTest.php @@ -156,7 +156,7 @@ public function testSetPropertyMultivalue() $prop = $node->getProperty('multivalue'); $this->assertEquals(\PHPCR\PropertyType::LONG, $prop->getType()); $this->assertTrue($prop->isMultiple()); - $this->assertEquals(array(1,2,3), $prop->getValue('multivalue')); + $this->assertEquals(array(1,2,3), $prop->getValue()); } public function testSetPropertyMultivalueOne() @@ -171,7 +171,47 @@ public function testSetPropertyMultivalueOne() $prop = $node->getProperty('multivalue2'); $this->assertEquals(\PHPCR\PropertyType::LONG, $prop->getType()); $this->assertTrue($prop->isMultiple()); - $this->assertEquals(array(1), $prop->getValue('multivalue2')); + $this->assertEquals(array(1), $prop->getValue()); + } + + /** + * 10.4.2.5 Multi-value Properties and Null + * + * Null values must be removed from the list of values. + */ + public function testSetPropertyMultivalueNull() + { + $prop = $this->node->setProperty('multivalue_null', array(1, null, 3)); + $this->assertEquals(array(1, 3), $this->node->getPropertyValue('multivalue_null')); + $this->assertEquals(\PHPCR\PropertyType::LONG, $prop->getType()); + $this->assertTrue($prop->isMultiple()); + + $this->saveAndRenewSession(); + $node = $this->session->getNode($this->nodePath); + $prop = $node->getProperty('multivalue_null'); + $this->assertEquals(\PHPCR\PropertyType::LONG, $prop->getType()); + $this->assertTrue($prop->isMultiple()); + $this->assertEquals(array(1, 3), $prop->getValue()); + } + + /** + * 10.4.2.5 Multi-value Properties and Null + * + * Null values must be removed from the list of values. + */ + public function testSetPropertyMultivalueAllNull() + { + $prop = $this->node->setProperty('multivalue_allnull', array(null, null, null)); + $this->assertEquals(array(), $this->node->getPropertyValue('multivalue_allnull')); + $this->assertEquals(\PHPCR\PropertyType::STRING, $prop->getType()); + $this->assertTrue($prop->isMultiple()); + + $this->saveAndRenewSession(); + $node = $this->session->getNode($this->nodePath); + $prop = $node->getProperty('multivalue_allnull'); + $this->assertEquals(\PHPCR\PropertyType::STRING, $prop->getType()); + $this->assertTrue($prop->isMultiple()); + $this->assertEquals(array(), $prop->getValue()); } public function testSetPropertyMultivalueRef() @@ -187,7 +227,7 @@ public function testSetPropertyMultivalueRef() $prop = $node->getProperty('multiref'); $this->assertEquals(\PHPCR\PropertyType::WEAKREFERENCE, $prop->getType()); $this->assertTrue($prop->isMultiple()); - $this->assertEquals($ids, $prop->getString('multiref')); + $this->assertEquals($ids, $prop->getString()); $nodes = $prop->getValue(); $this->assertInternalType('array', $nodes); $this->assertCount(3, $nodes);