diff --git a/tests/system/Router/RouterTest.php b/tests/system/Router/RouterTest.php index c5a05fb36ace..94e9d0d2542f 100644 --- a/tests/system/Router/RouterTest.php +++ b/tests/system/Router/RouterTest.php @@ -212,10 +212,14 @@ public function testAutoRouteFindsControllerWithFileAndMethod(): void $this->collection->setAutoRoute(true); $router = new Router($this->collection, $this->request); - $router->autoRoute('myController/someMethod'); + copy(TESTPATH . 'system/Router/Controllers/MyController.php', APPPATH . 'Controllers/Mycontroller.php'); - $this->assertSame('MyController', $router->controllerName()); - $this->assertSame('someMethod', $router->methodName()); + $router->autoRoute('Mycontroller/getSomemethod'); + + unlink(APPPATH . 'Controllers/Mycontroller.php'); + + $this->assertSame('Mycontroller', $router->controllerName()); + $this->assertSame('getSomemethod', $router->methodName()); } public function testAutoRouteFindsControllerWithFile(): void @@ -223,9 +227,13 @@ public function testAutoRouteFindsControllerWithFile(): void $this->collection->setAutoRoute(true); $router = new Router($this->collection, $this->request); - $router->autoRoute('myController'); + copy(TESTPATH . 'system/Router/Controllers/MyController.php', APPPATH . 'Controllers/Mycontroller.php'); - $this->assertSame('MyController', $router->controllerName()); + $router->autoRoute('mycontroller'); + + unlink(APPPATH . 'Controllers/Mycontroller.php'); + + $this->assertSame('Mycontroller', $router->controllerName()); $this->assertSame('index', $router->methodName()); } @@ -236,12 +244,16 @@ public function testAutoRouteFindsControllerWithSubfolder(): void mkdir(APPPATH . 'Controllers/Subfolder'); - $router->autoRoute('subfolder/myController/someMethod'); + copy(TESTPATH . 'system/Router/Controllers/Subfolder/MyController.php', APPPATH . 'Controllers/Subfolder/Mycontroller.php'); + + $router->autoRoute('subfolder/Mycontroller/getSomemethod'); + + unlink(APPPATH . 'Controllers/Subfolder/Mycontroller.php'); rmdir(APPPATH . 'Controllers/Subfolder'); - $this->assertSame('MyController', $router->controllerName()); - $this->assertSame('someMethod', $router->methodName()); + $this->assertSame('Mycontroller', $router->controllerName()); + $this->assertSame('getSomemethod', $router->methodName()); } public function testAutoRouteFindsDashedSubfolder(): void