Skip to content

Commit 26c96f6

Browse files
authored
Revert "Fixed RoueGroup::merge to format merged prefixes correctly. (#44011)" (#44072)
This reverts commit 0fa80d1.
1 parent c48ad5d commit 26c96f6

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

src/Illuminate/Routing/RouteGroup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ protected static function formatPrefix($new, $old, $prependExistingPrefix = true
6666
$old = $old['prefix'] ?? '';
6767

6868
if ($prependExistingPrefix) {
69-
return trim(isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old, '/');
69+
return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old;
7070
} else {
71-
return trim(isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old, '/');
71+
return isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old;
7272
}
7373
}
7474

tests/Routing/RoutingRouteTest.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,9 +1040,6 @@ public function testGroupMerging()
10401040
$this->assertEquals(['prefix' => null, 'namespace' => null, 'where' => [
10411041
'var1' => 'foo', 'var2' => 'bar',
10421042
]], RouteGroup::merge(['where' => ['var1' => 'foo', 'var2' => 'bar']], $old));
1043-
1044-
$old = [];
1045-
$this->assertEquals(['prefix' => 'foo', 'namespace' => null, 'where' => []], RouteGroup::merge(['prefix' => 'foo'], $old));
10461043
}
10471044

10481045
public function testRouteGrouping()
@@ -1171,34 +1168,6 @@ public function testNestedRouteGroupingPrefixing()
11711168
$routes = $router->getRoutes();
11721169
$route = $routes->getByName('Foo::baz');
11731170
$this->assertSame('bar/foo', $route->getAction('prefix'));
1174-
1175-
/*
1176-
* nested with first layer skipped (prefix prepended)
1177-
*/
1178-
$router = $this->getRouter();
1179-
$router->group(['as' => 'Foo::'], function () use ($router) {
1180-
$router->prefix('bar')->get('baz', ['as' => 'baz', function () {
1181-
return 'hello';
1182-
}]);
1183-
});
1184-
$routes = $router->getRoutes();
1185-
$route = $routes->getByName('Foo::baz');
1186-
$this->assertSame('bar', $route->getAction('prefix'));
1187-
1188-
/*
1189-
* nested with first layer skipped (prefix appended)
1190-
*/
1191-
$router = $this->getRouter();
1192-
$router->group(['as' => 'Foo::'], function () use ($router) {
1193-
$router->group(['prefix' => 'bar'], function () use ($router) {
1194-
$router->get('baz', ['as' => 'baz', function () {
1195-
return 'hello';
1196-
}]);
1197-
});
1198-
});
1199-
$routes = $router->getRoutes();
1200-
$route = $routes->getByName('Foo::baz');
1201-
$this->assertSame('bar', $route->getAction('prefix'));
12021171
}
12031172

12041173
public function testRouteMiddlewareMergeWithMiddlewareAttributesAsStrings()

0 commit comments

Comments
 (0)