Skip to content

Commit

Permalink
Revert "Fixed RoueGroup::merge to format merged prefixes correctly. (#…
Browse files Browse the repository at this point in the history
…44011)" (#44072)

This reverts commit 0fa80d1.
  • Loading branch information
driesvints authored Sep 9, 2022
1 parent c48ad5d commit 26c96f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Routing/RouteGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ protected static function formatPrefix($new, $old, $prependExistingPrefix = true
$old = $old['prefix'] ?? '';

if ($prependExistingPrefix) {
return trim(isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old, '/');
return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old;
} else {
return trim(isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old, '/');
return isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old;
}
}

Expand Down
31 changes: 0 additions & 31 deletions tests/Routing/RoutingRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1040,9 +1040,6 @@ public function testGroupMerging()
$this->assertEquals(['prefix' => null, 'namespace' => null, 'where' => [
'var1' => 'foo', 'var2' => 'bar',
]], RouteGroup::merge(['where' => ['var1' => 'foo', 'var2' => 'bar']], $old));

$old = [];
$this->assertEquals(['prefix' => 'foo', 'namespace' => null, 'where' => []], RouteGroup::merge(['prefix' => 'foo'], $old));
}

public function testRouteGrouping()
Expand Down Expand Up @@ -1171,34 +1168,6 @@ public function testNestedRouteGroupingPrefixing()
$routes = $router->getRoutes();
$route = $routes->getByName('Foo::baz');
$this->assertSame('bar/foo', $route->getAction('prefix'));

/*
* nested with first layer skipped (prefix prepended)
*/
$router = $this->getRouter();
$router->group(['as' => 'Foo::'], function () use ($router) {
$router->prefix('bar')->get('baz', ['as' => 'baz', function () {
return 'hello';
}]);
});
$routes = $router->getRoutes();
$route = $routes->getByName('Foo::baz');
$this->assertSame('bar', $route->getAction('prefix'));

/*
* nested with first layer skipped (prefix appended)
*/
$router = $this->getRouter();
$router->group(['as' => 'Foo::'], function () use ($router) {
$router->group(['prefix' => 'bar'], function () use ($router) {
$router->get('baz', ['as' => 'baz', function () {
return 'hello';
}]);
});
});
$routes = $router->getRoutes();
$route = $routes->getByName('Foo::baz');
$this->assertSame('bar', $route->getAction('prefix'));
}

public function testRouteMiddlewareMergeWithMiddlewareAttributesAsStrings()
Expand Down

0 comments on commit 26c96f6

Please sign in to comment.