diff --git a/src/Pecee/SimpleRouter/Route/IGroupRoute.php b/src/Pecee/SimpleRouter/Route/IGroupRoute.php index 1f41c27..e3be5d2 100644 --- a/src/Pecee/SimpleRouter/Route/IGroupRoute.php +++ b/src/Pecee/SimpleRouter/Route/IGroupRoute.php @@ -59,7 +59,7 @@ interface IGroupRoute extends IRoute * @param string $url * @return static */ - public function prependUrl(string $url): self; + public function prependPrefix(string $url): self; /** * Set prefix that child-routes will inherit. diff --git a/src/Pecee/SimpleRouter/Route/RouteGroup.php b/src/Pecee/SimpleRouter/Route/RouteGroup.php index 714a9a9..465c171 100644 --- a/src/Pecee/SimpleRouter/Route/RouteGroup.php +++ b/src/Pecee/SimpleRouter/Route/RouteGroup.php @@ -159,7 +159,7 @@ class RouteGroup extends Route implements IGroupRoute * @param string $url * @return static */ - public function prependUrl(string $url): IGroupRoute + public function prependPrefix(string $url): IGroupRoute { return $this->setPrefix(rtrim($url, '/') . $this->prefix); } diff --git a/tests/Pecee/SimpleRouter/EventHandlerTest.php b/tests/Pecee/SimpleRouter/EventHandlerTest.php index ec170c8..2473740 100644 --- a/tests/Pecee/SimpleRouter/EventHandlerTest.php +++ b/tests/Pecee/SimpleRouter/EventHandlerTest.php @@ -110,9 +110,6 @@ class EventHandlerTest extends \PHPUnit\Framework\TestCase $eventHandler = new EventHandler(); $eventHandler->register(EventHandler::EVENT_ADD_ROUTE, function(EventArgument $data) use($basePath) { - // Add basepath - $basePath = rtrim($basePath, '/'); - // Skip routes added by group if($data->isSubRoute === false) { @@ -121,7 +118,7 @@ class EventHandlerTest extends \PHPUnit\Framework\TestCase $data->route->prependUrl($basePath); break; case $data->route instanceof \Pecee\SimpleRouter\Route\IGroupRoute: - $data->route->setPrefix($basePath . $data->route->getPrefix()); + $data->route->prependPrefix($basePath); break; }