This repository was archived by the owner on Jan 29, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -391,6 +391,49 @@ public function testInjectRoutesFromConfigWillSkipSpecsThatOmitMiddleware()
391391 $ this ->assertEquals ([], $ app ->getRoutes ());
392392 }
393393
394+ public function testInjectRoutesFromConfigSetRouteNameViaArrayKey ()
395+ {
396+ $ config = [
397+ 'routes ' => [
398+ 'home ' => [
399+ 'path ' => '/ ' ,
400+ 'middleware ' => new TestAsset \InteropMiddleware (),
401+ ],
402+ ],
403+ ];
404+ $ this ->container ->has ('config ' )->willReturn (false );
405+ $ app = $ this ->createApplication ();
406+
407+ ApplicationConfigInjectionDelegator::injectRoutesFromConfig ($ app , $ config );
408+
409+ $ routes = $ app ->getRoutes ();
410+
411+ $ route = array_shift ($ routes );
412+ $ this ->assertEquals ('home ' , $ route ->getName ());
413+ }
414+
415+ public function testInjectRoutesFromConfigRouteSpecNameOverrideArrayKeyName ()
416+ {
417+ $ config = [
418+ 'routes ' => [
419+ 'home ' => [
420+ 'name ' => 'homepage ' ,
421+ 'path ' => '/ ' ,
422+ 'middleware ' => new TestAsset \InteropMiddleware (),
423+ ],
424+ ],
425+ ];
426+ $ this ->container ->has ('config ' )->willReturn (false );
427+ $ app = $ this ->createApplication ();
428+
429+ ApplicationConfigInjectionDelegator::injectRoutesFromConfig ($ app , $ config );
430+
431+ $ routes = $ app ->getRoutes ();
432+
433+ $ route = array_shift ($ routes );
434+ $ this ->assertEquals ('homepage ' , $ route ->getName ());
435+ }
436+
394437 public function testInjectPipelineFromConfigRaisesExceptionForSpecsOmittingMiddlewareKey ()
395438 {
396439 $ config = [
You can’t perform that action at this time.
0 commit comments