@@ -238,6 +238,66 @@ public function testMultilangArticle($data, $expectedPaths)
238
238
}
239
239
}
240
240
241
+ public function provideUpdateMultilangArticle ()
242
+ {
243
+ return array (
244
+ array (
245
+ array (
246
+ 'en ' => 'Hello everybody! ' ,
247
+ 'fr ' => 'Bonjour le monde! ' ,
248
+ 'de ' => 'Gutentag ' ,
249
+ 'es ' => 'Hola todo el mundo ' ,
250
+ ),
251
+ array (
252
+ 'test/auto-route/articles/en/hello-everybody ' ,
253
+ 'test/auto-route/articles/fr/bonjour-le-monde ' ,
254
+ 'test/auto-route/articles/de/gutentag-und-auf-wiedersehen ' ,
255
+ 'test/auto-route/articles/es/hola-todo-el-mundo ' ,
256
+ ),
257
+ ),
258
+ );
259
+ }
260
+
261
+ /**
262
+ * @dataProvider provideUpdateMultilangArticle
263
+ */
264
+ public function testUpdateMultilangArticle ($ data , $ expectedPaths )
265
+ {
266
+ $ article = new Article ;
267
+ $ article ->path = '/test/article-1 ' ;
268
+ $ this ->getDm ()->persist ($ article );
269
+
270
+ foreach ($ data as $ lang => $ title ) {
271
+ $ article ->title = $ title ;
272
+ $ this ->getDm ()->bindTranslation ($ article , $ lang );
273
+ }
274
+
275
+ $ this ->getDm ()->flush ();
276
+
277
+ $ article_de = $ this ->getDm ()->findTranslation ('Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Resources\Document\Article ' , '/test/article-1 ' , 'de ' );
278
+ $ article_de ->title .= '-und-auf-wiedersehen ' ;
279
+ $ this ->getDm ()->bindTranslation ($ article_de , 'de ' );
280
+ $ this ->getDm ()->persist ($ article_de );
281
+
282
+ $ this ->getDm ()->flush ();
283
+ $ this ->getDm ()->clear ();
284
+
285
+ foreach ($ expectedPaths as $ i => $ expectedPath ) {
286
+ $ route = $ this ->getDm ()->find (null , $ expectedPath );
287
+
288
+ $ this ->assertNotNull ($ route );
289
+ $ this ->assertInstanceOf ('Symfony\Cmf\Bundle\RoutingAutoBundle\Model\AutoRoute ' , $ route );
290
+
291
+ $ content = $ route ->getContent ();
292
+
293
+ $ this ->assertNotNull ($ content );
294
+ $ this ->assertInstanceOf ('Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Resources\Document\Article ' , $ content );
295
+
296
+ // We havn't loaded the translation for the document, so it is always in the default language
297
+ $ this ->assertEquals ('Hello everybody! ' , $ content ->title );
298
+ }
299
+ }
300
+
241
301
/**
242
302
* Ensure that we can map parent classes: #56
243
303
*/
0 commit comments