@@ -91,6 +91,7 @@ public function testLoadTranslation()
9191 $ node = $ this ->getTestNode ();
9292 $ node ->setProperty (self ::propertyNameForLocale ('en ' , 'topic ' ), 'English topic ' );
9393 $ node ->setProperty (self ::propertyNameForLocale ('en ' , 'text ' ), 'English text ' );
94+ $ node ->setProperty (self ::propertyNameForLocale ('en ' , 'custom-property-name ' ), 'Custom property name ' );
9495 $ node ->setProperty (self ::propertyNameForLocale ('fr ' , 'topic ' ), 'Sujet français ' );
9596 $ node ->setProperty (self ::propertyNameForLocale ('fr ' , 'text ' ), 'Texte français ' );
9697 $ node ->setProperty ('author ' , 'John Doe ' );
@@ -106,6 +107,7 @@ public function testLoadTranslation()
106107 // And check the translatable properties have the correct value
107108 $ this ->assertEquals ('English topic ' , $ doc ->topic );
108109 $ this ->assertEquals ('English text ' , $ doc ->getText ());
110+ $ this ->assertEquals ('Custom property name ' , $ doc ->customPropertyName );
109111 $ this ->assertEquals (array (), $ doc ->getSettings ()); // nullable
110112
111113 // Load another language and test the document has been updated
@@ -143,6 +145,7 @@ public function testTranslationNullProperties()
143145 $ data ['topic ' ] = 'Some interesting subject ' ;
144146 $ data ['text ' ] = 'Lorem ipsum... ' ;
145147 $ data ['nullable ' ] = 'not null ' ;
148+ $ data ['customPropertyName ' ] = 'Custom property name ' ;
146149 $ data ['settings ' ] = array ('key ' => 'value ' );
147150
148151 $ node = $ this ->getTestNode ();
@@ -155,6 +158,7 @@ public function testTranslationNullProperties()
155158 $ data = array ();
156159 $ data ['topic ' ] = 'Un sujet intéressant ' ;
157160 $ data ['text ' ] = 'Lorem français ' ;
161+ $ data ['customPropertyName ' ] = null ;
158162
159163 $ strategy ->saveTranslation ($ data , $ node , $ this ->metadata , 'fr ' );
160164 $ this ->dm ->flush ();
@@ -167,13 +171,20 @@ public function testTranslationNullProperties()
167171 $ this ->assertEquals ('Some interesting subject ' , $ doc ->topic );
168172 $ this ->assertEquals ('Lorem ipsum... ' , $ doc ->getText ());
169173 $ this ->assertEquals ('not null ' , $ doc ->nullable );
174+ $ this ->assertEquals ('Custom property name ' , $ doc ->customPropertyName );
170175 $ this ->assertEquals (array ('key ' => 'value ' ), $ doc ->getSettings ());
171176
172177 $ strategy ->loadTranslation ($ doc , $ node , $ this ->metadata , 'fr ' );
173178 $ this ->assertEquals ('Un sujet intéressant ' , $ doc ->topic );
174179 $ this ->assertEquals ('Lorem français ' , $ doc ->getText ());
175180 $ this ->assertNull ($ doc ->nullable );
181+ $ this ->assertNull ($ doc ->customPropertyName );
176182 $ this ->assertEquals (array (), $ doc ->getSettings ());
183+
184+ $ nullFields = $ node ->getProperty ('phpcr_locale:fr ' . AttributeTranslationStrategy::NULLFIELDS )->getValue ();
185+ $ this ->assertEquals (array (
186+ 'custom-property-name ' ,
187+ ), $ nullFields );
177188 }
178189
179190 public function testRemoveTranslation ()
@@ -276,6 +287,10 @@ public function testTranslationArrayProperties()
276287 'is-active ' => 'true ' ,
277288 'url ' => 'great-article-in-english.html '
278289 );
290+ $ data ['customNameSettings ' ] = array (
291+ 'is-active ' => 'true ' ,
292+ 'url ' => 'great-article-in-english.html '
293+ );
279294
280295 $ node = $ this ->getTestNode ();
281296 $ node ->setProperty ('author ' , 'John Doe ' );
@@ -290,6 +305,10 @@ public function testTranslationArrayProperties()
290305 'is-active ' => 'true ' ,
291306 'url ' => 'super-article-en-francais.html '
292307 );
308+ $ data ['customNameSettings ' ] = array (
309+ 'is-active ' => 'true ' ,
310+ 'url ' => 'super-article-en-francais.html '
311+ );
293312
294313 $ strategy ->saveTranslation ($ data , $ node , $ this ->metadata , 'fr ' );
295314 $ this ->dm ->flush ();
@@ -305,13 +324,21 @@ public function testTranslationArrayProperties()
305324 'is-active ' => 'true ' ,
306325 'url ' => 'great-article-in-english.html '
307326 ), $ doc ->getSettings ());
327+ $ this ->assertEquals (array (
328+ 'is-active ' => 'true ' ,
329+ 'url ' => 'great-article-in-english.html '
330+ ), $ doc ->customNameSettings );
308331
309332 $ strategy ->loadTranslation ($ doc , $ node , $ this ->metadata , 'fr ' );
310333 $ this ->assertEquals (array ('is-active ' , 'url ' ), array_keys ($ doc ->getSettings ()));
311334 $ this ->assertEquals (array (
312335 'is-active ' => 'true ' ,
313336 'url ' => 'super-article-en-francais.html '
314337 ), $ doc ->getSettings ());
338+ $ this ->assertEquals (array (
339+ 'is-active ' => 'true ' ,
340+ 'url ' => 'super-article-en-francais.html '
341+ ), $ doc ->customNameSettings );
315342 }
316343
317344 public function testQueryBuilder ()
0 commit comments