@@ -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,17 @@ 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
+ if (null === $ autoRoute ) {
386
+ var_dump ($ newPath );die ();;
387
+ }
388
+ $ this ->assertNotNull ($ autoRoute , 'Autoroute exists for: ' . $ newPath );
389
+ $ this ->assertEquals (AutoRouteInterface::TYPE_PRIMARY , $ autoRoute ->getDefault ('type ' ));
387
390
}
388
391
}
389
392
@@ -409,6 +412,38 @@ public function testLeaveRedirectAndRenameToOriginal()
409
412
$ this ->getDm ()->flush ();
410
413
}
411
414
415
+ /**
416
+ * Leave direct should migrate children
417
+ */
418
+ public function testLeaveRedirectChildrenMigrations ()
419
+ {
420
+ $ article1 = new SeoArticle ;
421
+ $ article1 ->title = 'Hai ' ;
422
+ $ article1 ->path = '/test/article-1 ' ;
423
+ $ this ->getDm ()->persist ($ article1 );
424
+ $ this ->getDm ()->flush ();
425
+
426
+ // add a child to the route
427
+ $ parentRoute = $ this ->getDm ()->find (null , '/test/auto-route/seo-articles/hai ' );
428
+ $ childRoute = new AutoRoute ();
429
+ $ childRoute ->setName ('foo ' );
430
+ $ childRoute ->setParent ($ parentRoute );
431
+ $ this ->getDm ()->persist ($ childRoute );
432
+ $ this ->getDm ()->flush ();
433
+
434
+ $ article1 ->title = 'Ho ' ;
435
+ $ this ->getDm ()->persist ($ article1 );
436
+ $ this ->getDm ()->flush ();
437
+
438
+ $ originalRoute = $ this ->getDm ()->find (null , '/test/auto-route/seo-articles/hai ' );
439
+ $ this ->assertNotNull ($ originalRoute );
440
+ $ this ->assertCount (0 , $ this ->getDm ()->getChildren ($ originalRoute ));
441
+
442
+ $ newRoute = $ this ->getDm ()->find (null , '/test/auto-route/seo-articles/ho ' );
443
+ $ this ->assertNotNull ($ newRoute );
444
+ $ this ->assertCount (1 , $ this ->getDm ()->getChildren ($ newRoute ));
445
+ }
446
+
412
447
/**
413
448
* Ensure that we can map parent classes: #56
414
449
*/
0 commit comments