From 959fc4ad944f628ba15b935d97643c4b99a78497 Mon Sep 17 00:00:00 2001 From: neznaika0 Date: Tue, 17 Nov 2026 22:32:48 +0300 Subject: [PATCH 1/3] fix: Fix the HTTP methods in the tests --- tests/Authentication/Filters/ChainFilterTest.php | 2 +- tests/Authentication/Filters/GroupFilterTest.php | 4 ++-- tests/Authentication/Filters/HmacFilterTest.php | 2 +- tests/Authentication/Filters/JWTFilterTest.php | 2 +- tests/Authentication/Filters/PermissionFilterTest.php | 4 ++-- tests/Authentication/Filters/SessionFilterTest.php | 4 ++-- tests/Authentication/Filters/TokenFilterTest.php | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/Authentication/Filters/ChainFilterTest.php b/tests/Authentication/Filters/ChainFilterTest.php index baec7e8ef..99124c612 100644 --- a/tests/Authentication/Filters/ChainFilterTest.php +++ b/tests/Authentication/Filters/ChainFilterTest.php @@ -31,7 +31,7 @@ final class ChainFilterTest extends AbstractFilterTestCase public function testFilterNotAuthorized(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertRedirectTo('/login'); diff --git a/tests/Authentication/Filters/GroupFilterTest.php b/tests/Authentication/Filters/GroupFilterTest.php index a30e90f4a..97330c884 100644 --- a/tests/Authentication/Filters/GroupFilterTest.php +++ b/tests/Authentication/Filters/GroupFilterTest.php @@ -30,7 +30,7 @@ final class GroupFilterTest extends AbstractFilterTestCase public function testFilterNotAuthorized(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertRedirectTo('/login'); @@ -41,7 +41,7 @@ public function testFilterNotAuthorized(): void public function testFilterNotAuthorizedStoresRedirectToEntranceUrlIntoSession(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertRedirectTo('/login'); diff --git a/tests/Authentication/Filters/HmacFilterTest.php b/tests/Authentication/Filters/HmacFilterTest.php index ae2235ebd..67cc95278 100644 --- a/tests/Authentication/Filters/HmacFilterTest.php +++ b/tests/Authentication/Filters/HmacFilterTest.php @@ -32,7 +32,7 @@ final class HmacFilterTest extends AbstractFilterTestCase public function testFilterNotAuthorized(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertStatus(401); diff --git a/tests/Authentication/Filters/JWTFilterTest.php b/tests/Authentication/Filters/JWTFilterTest.php index c4b14c8f2..4477abf1c 100644 --- a/tests/Authentication/Filters/JWTFilterTest.php +++ b/tests/Authentication/Filters/JWTFilterTest.php @@ -65,7 +65,7 @@ protected function setUp(): void public function testFilterNotAuthorized(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertStatus(401); diff --git a/tests/Authentication/Filters/PermissionFilterTest.php b/tests/Authentication/Filters/PermissionFilterTest.php index b1305bfa4..a4ff0cf0f 100644 --- a/tests/Authentication/Filters/PermissionFilterTest.php +++ b/tests/Authentication/Filters/PermissionFilterTest.php @@ -30,7 +30,7 @@ final class PermissionFilterTest extends AbstractFilterTestCase public function testFilterNotAuthorized(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertRedirectTo('/login'); @@ -41,7 +41,7 @@ public function testFilterNotAuthorized(): void public function testFilterNotAuthorizedStoresRedirectToEntranceUrlIntoSession(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertRedirectTo('/login'); diff --git a/tests/Authentication/Filters/SessionFilterTest.php b/tests/Authentication/Filters/SessionFilterTest.php index 933d10041..0bd1c5595 100644 --- a/tests/Authentication/Filters/SessionFilterTest.php +++ b/tests/Authentication/Filters/SessionFilterTest.php @@ -33,7 +33,7 @@ final class SessionFilterTest extends AbstractFilterTestCase public function testFilterNotAuthorized(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertRedirectTo('/login'); @@ -140,7 +140,7 @@ public function testRedirectsInactiveUsersToStoredConditionalActivationAction(): public function testStoreRedirectsToEntraceUrlIntoSession(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertRedirectTo('/login'); diff --git a/tests/Authentication/Filters/TokenFilterTest.php b/tests/Authentication/Filters/TokenFilterTest.php index fb399aed6..cb4ea7fcf 100644 --- a/tests/Authentication/Filters/TokenFilterTest.php +++ b/tests/Authentication/Filters/TokenFilterTest.php @@ -31,7 +31,7 @@ final class TokenFilterTest extends AbstractFilterTestCase public function testFilterNotAuthorized(): void { - $result = $this->call('get', 'protected-route'); + $result = $this->get('protected-route'); $result->assertStatus(401); From b66088695b9dac6551a8fde1b09ea75a1469c203 Mon Sep 17 00:00:00 2001 From: neznaika0 Date: Tue, 17 Nov 2026 22:37:48 +0300 Subject: [PATCH 2/3] fix: Fix the HTTP methods --- src/Config/AuthRoutes.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Config/AuthRoutes.php b/src/Config/AuthRoutes.php index 141978565..c4b1b68ee 100644 --- a/src/Config/AuthRoutes.php +++ b/src/Config/AuthRoutes.php @@ -14,50 +14,51 @@ namespace CodeIgniter\Shield\Config; use CodeIgniter\Config\BaseConfig; +use CodeIgniter\HTTP\Method; class AuthRoutes extends BaseConfig { public array $routes = [ 'register' => [ [ - 'get', + Method::GET, 'register', 'RegisterController::registerView', 'register', // Route name ], [ - 'post', + Method::POST, 'register', 'RegisterController::registerAction', ], ], 'login' => [ [ - 'get', + Method::GET, 'login', 'LoginController::loginView', 'login', // Route name ], [ - 'post', + Method::POST, 'login', 'LoginController::loginAction', ], ], 'magic-link' => [ [ - 'get', + Method::GET, 'login/magic-link', 'MagicLinkController::loginView', 'magic-link', // Route name ], [ - 'post', + Method::POST, 'login/magic-link', 'MagicLinkController::loginAction', ], [ - 'get', + Method::GET, 'login/verify-magic-link', 'MagicLinkController::verify', 'verify-magic-link', // Route name @@ -65,7 +66,7 @@ class AuthRoutes extends BaseConfig ], 'logout' => [ [ - 'get', + Method::GET, 'logout', 'LoginController::logoutAction', 'logout', // Route name @@ -73,19 +74,19 @@ class AuthRoutes extends BaseConfig ], 'auth-actions' => [ [ - 'get', + Method::GET, 'auth/a/show', 'ActionController::show', 'auth-action-show', // Route name ], [ - 'post', + Method::POST, 'auth/a/handle', 'ActionController::handle', 'auth-action-handle', // Route name ], [ - 'post', + Method::POST, 'auth/a/verify', 'ActionController::verify', 'auth-action-verify', // Route name From eb0755c325612b11a4a620106a85f8839d2066d6 Mon Sep 17 00:00:00 2001 From: neznaika0 Date: Wed, 18 Nov 2026 19:40:24 +0300 Subject: [PATCH 3/3] fix: Change the `Method` constants to strings --- src/Config/AuthRoutes.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Config/AuthRoutes.php b/src/Config/AuthRoutes.php index c4b1b68ee..5bf96b650 100644 --- a/src/Config/AuthRoutes.php +++ b/src/Config/AuthRoutes.php @@ -14,51 +14,50 @@ namespace CodeIgniter\Shield\Config; use CodeIgniter\Config\BaseConfig; -use CodeIgniter\HTTP\Method; class AuthRoutes extends BaseConfig { public array $routes = [ 'register' => [ [ - Method::GET, + 'GET', 'register', 'RegisterController::registerView', 'register', // Route name ], [ - Method::POST, + 'POST', 'register', 'RegisterController::registerAction', ], ], 'login' => [ [ - Method::GET, + 'GET', 'login', 'LoginController::loginView', 'login', // Route name ], [ - Method::POST, + 'POST', 'login', 'LoginController::loginAction', ], ], 'magic-link' => [ [ - Method::GET, + 'GET', 'login/magic-link', 'MagicLinkController::loginView', 'magic-link', // Route name ], [ - Method::POST, + 'POST', 'login/magic-link', 'MagicLinkController::loginAction', ], [ - Method::GET, + 'GET', 'login/verify-magic-link', 'MagicLinkController::verify', 'verify-magic-link', // Route name @@ -66,7 +65,7 @@ class AuthRoutes extends BaseConfig ], 'logout' => [ [ - Method::GET, + 'GET', 'logout', 'LoginController::logoutAction', 'logout', // Route name @@ -74,19 +73,19 @@ class AuthRoutes extends BaseConfig ], 'auth-actions' => [ [ - Method::GET, + 'GET', 'auth/a/show', 'ActionController::show', 'auth-action-show', // Route name ], [ - Method::POST, + 'POST', 'auth/a/handle', 'ActionController::handle', 'auth-action-handle', // Route name ], [ - Method::POST, + 'POST', 'auth/a/verify', 'ActionController::verify', 'auth-action-verify', // Route name