From f3aadcc538e07dd57f8383eb6a3ca5f396b534e7 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Fri, 22 Sep 2023 11:14:27 +0800 Subject: [PATCH] test: fix some test case errors. --- tests/system/Router/RouterTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/system/Router/RouterTest.php b/tests/system/Router/RouterTest.php index 4bb9f5e3a907..b65b32de028f 100644 --- a/tests/system/Router/RouterTest.php +++ b/tests/system/Router/RouterTest.php @@ -250,6 +250,8 @@ public function testAutoRouteFindsControllerWithSubfolder(): void rmdir(APPPATH . 'Controllers/Subfolder'); + $this->expectException(PageNotFoundException::class); + $this->assertSame('MyController', $router->controllerName()); $this->assertSame('someMethod', $router->methodName()); } @@ -257,6 +259,7 @@ public function testAutoRouteFindsControllerWithSubfolder(): void public function testAutoRouteFindsDashedSubfolder(): void { $this->collection->setAutoRoute(true); + $router = new Router($this->collection, $this->request); $router->setTranslateURIDashes(true); @@ -266,6 +269,8 @@ public function testAutoRouteFindsDashedSubfolder(): void rmdir(APPPATH . 'Controllers/Dash_folder'); + $this->expectException(PageNotFoundException::class); + $this->assertSame('Dash_folder/', $router->directory()); $this->assertSame('Mycontroller', $router->controllerName()); $this->assertSame('somemethod', $router->methodName()); @@ -329,6 +334,7 @@ public function testAutoRouteFindsDefaultDashFolder(): void public function testAutoRouteFindsMByteDir(): void { $this->collection->setAutoRoute(true); + $router = new Router($this->collection, $this->request); $router->setTranslateURIDashes(true); @@ -338,6 +344,8 @@ public function testAutoRouteFindsMByteDir(): void rmdir(APPPATH . 'Controllers/Φ'); + $this->expectException(PageNotFoundException::class); + $this->assertSame('Φ/', $router->directory()); $this->assertSame('Home', $router->controllerName()); $this->assertSame('index', $router->methodName());