Skip to content

Commit 28aab1f

Browse files
committed
Merge branch '4.1' into 4.2
2 parents 43603e2 + 7ede44b commit 28aab1f

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

src/Illuminate/Routing/Router.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -749,14 +749,16 @@ public static function mergeGroup($new, $old)
749749
*/
750750
protected static function formatUsesPrefix($new, $old)
751751
{
752-
if (isset($new['namespace']))
752+
if (isset($new['namespace']) && isset($old['namespace']))
753753
{
754754
return trim(array_get($old, 'namespace'), '\\').'\\'.trim($new['namespace'], '\\');
755755
}
756-
else
756+
elseif (isset($new['namespace']))
757757
{
758-
return array_get($old, 'namespace');
758+
return trim($new['namespace'], '\\');
759759
}
760+
761+
return array_get($old, 'namespace');
760762
}
761763

762764
/**
@@ -772,10 +774,8 @@ protected static function formatGroupPrefix($new, $old)
772774
{
773775
return trim(array_get($old, 'prefix'), '/').'/'.trim($new['prefix'], '/');
774776
}
775-
else
776-
{
777-
return array_get($old, 'prefix');
778-
}
777+
778+
return array_get($old, 'prefix');
779779
}
780780

781781
/**

tests/Routing/RoutingRouteTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,20 @@ public function testMergingControllerUses()
679679
$action = $routes[0]->getAction();
680680

681681
$this->assertEquals('Namespace\\Nested\\Controller', $action['controller']);
682+
683+
684+
$router = $this->getRouter();
685+
$router->group(array('prefix' => 'baz'), function() use ($router)
686+
{
687+
$router->group(array('namespace' => 'Namespace'), function() use ($router)
688+
{
689+
$router->get('foo/bar', 'Controller');
690+
});
691+
});
692+
$routes = $router->getRoutes()->getRoutes();
693+
$action = $routes[0]->getAction();
694+
695+
$this->assertEquals('Namespace\\Controller', $action['controller']);
682696
}
683697

684698

0 commit comments

Comments
 (0)