@@ -341,7 +341,7 @@ public function provideLeaveRedirect()
341
341
array (
342
342
'test/auto-route/seo-articles/en/goodbye-everybody ' ,
343
343
'test/auto-route/seo-articles/fr/aurevoir-le-monde ' ,
344
- 'test/auto-route/seo-articles/de/aud -weidersehn ' ,
344
+ 'test/auto-route/seo-articles/de/auf -weidersehn ' ,
345
345
'test/auto-route/seo-articles/es/adios-todo-el-mundo ' ,
346
346
),
347
347
),
@@ -376,14 +376,14 @@ public function testLeaveRedirect($data, $updatedData, $expectedRedirectRoutePat
376
376
377
377
foreach ($ expectedRedirectRoutePaths as $ originalPath ) {
378
378
$ redirectRoute = $ this ->getDm ()->find (null , $ originalPath );
379
- $ this ->assertNotNull ($ redirectRoute , 'Autoroute exists for: ' . $ originalPath );
379
+ $ this ->assertNotNull ($ redirectRoute , 'Redirect exists for: ' . $ originalPath );
380
380
$ this ->assertEquals (AutoRouteInterface::TYPE_REDIRECT , $ redirectRoute ->getDefault ('type ' ));
381
381
}
382
382
383
383
foreach ($ expectedAutoRoutePaths as $ newPath ) {
384
384
$ autoRoute = $ this ->getDm ()->find (null , $ newPath );
385
- $ this ->assertNotNull ($ redirectRoute , 'Autoroute exists for: ' . $ originalPath );
386
- $ this ->assertEquals (AutoRouteInterface::TYPE_REDIRECT , $ redirectRoute ->getDefault ('type ' ));
385
+ $ this ->assertNotNull ($ autoRoute , 'Autoroute exists for: ' . $ newPath );
386
+ $ this ->assertEquals (AutoRouteInterface::TYPE_PRIMARY , $ autoRoute ->getDefault ('type ' ));
387
387
}
388
388
}
389
389
@@ -409,6 +409,38 @@ public function testLeaveRedirectAndRenameToOriginal()
409
409
$ this ->getDm ()->flush ();
410
410
}
411
411
412
+ /**
413
+ * Leave direct should migrate children
414
+ */
415
+ public function testLeaveRedirectChildrenMigrations ()
416
+ {
417
+ $ article1 = new SeoArticle ;
418
+ $ article1 ->title = 'Hai ' ;
419
+ $ article1 ->path = '/test/article-1 ' ;
420
+ $ this ->getDm ()->persist ($ article1 );
421
+ $ this ->getDm ()->flush ();
422
+
423
+ // add a child to the route
424
+ $ parentRoute = $ this ->getDm ()->find (null , '/test/auto-route/seo-articles/hai ' );
425
+ $ childRoute = new AutoRoute ();
426
+ $ childRoute ->setName ('foo ' );
427
+ $ childRoute ->setParent ($ parentRoute );
428
+ $ this ->getDm ()->persist ($ childRoute );
429
+ $ this ->getDm ()->flush ();
430
+
431
+ $ article1 ->title = 'Ho ' ;
432
+ $ this ->getDm ()->persist ($ article1 );
433
+ $ this ->getDm ()->flush ();
434
+
435
+ $ originalRoute = $ this ->getDm ()->find (null , '/test/auto-route/seo-articles/hai ' );
436
+ $ this ->assertNotNull ($ originalRoute );
437
+ $ this ->assertCount (0 , $ this ->getDm ()->getChildren ($ originalRoute ));
438
+
439
+ $ newRoute = $ this ->getDm ()->find (null , '/test/auto-route/seo-articles/ho ' );
440
+ $ this ->assertNotNull ($ newRoute );
441
+ $ this ->assertCount (1 , $ this ->getDm ()->getChildren ($ newRoute ));
442
+ }
443
+
412
444
/**
413
445
* Ensure that we can map parent classes: #56
414
446
*/
0 commit comments