From 8b11377fe83739e00698548ac8ead9fb28175a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Wed, 31 Mar 2021 03:25:35 +0200 Subject: [PATCH] Fixed typo --- src/Pecee/SimpleRouter/Route/IGroupRoute.php | 2 +- src/Pecee/SimpleRouter/Route/RouteGroup.php | 2 +- tests/Pecee/SimpleRouter/EventHandlerTest.php | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) 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; }