@@ -156,7 +156,7 @@ public function testSetPropertyMultivalue()
156156 $ prop = $ node ->getProperty ('multivalue ' );
157157 $ this ->assertEquals (\PHPCR \PropertyType::LONG , $ prop ->getType ());
158158 $ this ->assertTrue ($ prop ->isMultiple ());
159- $ this ->assertEquals (array (1 ,2 ,3 ), $ prop ->getValue (' multivalue ' ));
159+ $ this ->assertEquals (array (1 ,2 ,3 ), $ prop ->getValue ());
160160 }
161161
162162 public function testSetPropertyMultivalueOne ()
@@ -171,7 +171,47 @@ public function testSetPropertyMultivalueOne()
171171 $ prop = $ node ->getProperty ('multivalue2 ' );
172172 $ this ->assertEquals (\PHPCR \PropertyType::LONG , $ prop ->getType ());
173173 $ this ->assertTrue ($ prop ->isMultiple ());
174- $ this ->assertEquals (array (1 ), $ prop ->getValue ('multivalue2 ' ));
174+ $ this ->assertEquals (array (1 ), $ prop ->getValue ());
175+ }
176+
177+ /**
178+ * 10.4.2.5 Multi-value Properties and Null
179+ *
180+ * Null values must be removed from the list of values.
181+ */
182+ public function testSetPropertyMultivalueNull ()
183+ {
184+ $ prop = $ this ->node ->setProperty ('multivalue_null ' , array (1 , null , 3 ));
185+ $ this ->assertEquals (array (1 , 3 ), $ this ->node ->getPropertyValue ('multivalue_null ' ));
186+ $ this ->assertEquals (\PHPCR \PropertyType::LONG , $ prop ->getType ());
187+ $ this ->assertTrue ($ prop ->isMultiple ());
188+
189+ $ this ->saveAndRenewSession ();
190+ $ node = $ this ->session ->getNode ($ this ->nodePath );
191+ $ prop = $ node ->getProperty ('multivalue_null ' );
192+ $ this ->assertEquals (\PHPCR \PropertyType::LONG , $ prop ->getType ());
193+ $ this ->assertTrue ($ prop ->isMultiple ());
194+ $ this ->assertEquals (array (1 , 3 ), $ prop ->getValue ());
195+ }
196+
197+ /**
198+ * 10.4.2.5 Multi-value Properties and Null
199+ *
200+ * Null values must be removed from the list of values.
201+ */
202+ public function testSetPropertyMultivalueAllNull ()
203+ {
204+ $ prop = $ this ->node ->setProperty ('multivalue_allnull ' , array (null , null , null ));
205+ $ this ->assertEquals (array (), $ this ->node ->getPropertyValue ('multivalue_allnull ' ));
206+ $ this ->assertEquals (\PHPCR \PropertyType::STRING , $ prop ->getType ());
207+ $ this ->assertTrue ($ prop ->isMultiple ());
208+
209+ $ this ->saveAndRenewSession ();
210+ $ node = $ this ->session ->getNode ($ this ->nodePath );
211+ $ prop = $ node ->getProperty ('multivalue_allnull ' );
212+ $ this ->assertEquals (\PHPCR \PropertyType::STRING , $ prop ->getType ());
213+ $ this ->assertTrue ($ prop ->isMultiple ());
214+ $ this ->assertEquals (array (), $ prop ->getValue ());
175215 }
176216
177217 public function testSetPropertyMultivalueRef ()
@@ -187,7 +227,7 @@ public function testSetPropertyMultivalueRef()
187227 $ prop = $ node ->getProperty ('multiref ' );
188228 $ this ->assertEquals (\PHPCR \PropertyType::WEAKREFERENCE , $ prop ->getType ());
189229 $ this ->assertTrue ($ prop ->isMultiple ());
190- $ this ->assertEquals ($ ids , $ prop ->getString (' multiref ' ));
230+ $ this ->assertEquals ($ ids , $ prop ->getString ());
191231 $ nodes = $ prop ->getValue ();
192232 $ this ->assertInternalType ('array ' , $ nodes );
193233 $ this ->assertCount (3 , $ nodes );
0 commit comments