From 69c9c905994818e24ab4355ff07e28967b05a34f Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Wed, 15 Mar 2023 06:29:00 +0330 Subject: [PATCH 1/5] feat: add `SHIELD_VERSION` to `Auth.php` --- src/Auth.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Auth.php b/src/Auth.php index 35e5bd30f..c67ee804a 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -25,6 +25,11 @@ */ class Auth { + /** + * The current version of CodeIgniter Shield + */ + public const SHIELD_VERSION = 'v1.0.0-beta.5'; + protected Authentication $authenticate; /** From bfe0711ee7bfbf0c2886d61a28c228d91be19c9e Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Wed, 15 Mar 2023 06:54:39 +0330 Subject: [PATCH 2/5] feat: add `SHIELD_VERSION` to debug_tools --- src/Collectors/Auth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Collectors/Auth.php b/src/Collectors/Auth.php index ad19e5637..a9185f921 100644 --- a/src/Collectors/Auth.php +++ b/src/Collectors/Auth.php @@ -42,7 +42,7 @@ class Auth extends BaseCollector * * @var string */ - protected $title = 'Auth'; + protected $title = 'Shield'; private ShieldAuth $auth; @@ -56,7 +56,7 @@ public function __construct() */ public function getTitleDetails(): string { - return get_class($this->auth->getAuthenticator()); + return ShieldAuth::SHIELD_VERSION . ' | ' . get_class($this->auth->getAuthenticator()); } /** From 89969b6b0c3a56b745b063df0d58ccde87608631 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Wed, 15 Mar 2023 07:01:58 +0330 Subject: [PATCH 3/5] test: update for check `SHIELD_VERSION` --- tests/Collectors/AuthTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Collectors/AuthTest.php b/tests/Collectors/AuthTest.php index 1c3c50495..45d7a5871 100644 --- a/tests/Collectors/AuthTest.php +++ b/tests/Collectors/AuthTest.php @@ -4,6 +4,7 @@ namespace Tests\Collectors; +use CodeIgniter\Shield\Auth as ShieldAuth; use CodeIgniter\Shield\Authentication\Authenticators\Session; use CodeIgniter\Shield\Collectors\Auth; use CodeIgniter\Shield\Entities\User; @@ -71,6 +72,7 @@ public function testGetTitleDetails(): void { $output = $this->collector->getTitleDetails(); + $this->assertStringContainsString(ShieldAuth::SHIELD_VERSION, $output); $this->assertStringContainsString(Session::class, $output); } From f631292290f741fb7a7b6efe595ee95d92564328 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Wed, 15 Mar 2023 12:03:55 +0330 Subject: [PATCH 4/5] Update src/Collectors/Auth.php --- src/Collectors/Auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Collectors/Auth.php b/src/Collectors/Auth.php index a9185f921..f265b2e58 100644 --- a/src/Collectors/Auth.php +++ b/src/Collectors/Auth.php @@ -42,7 +42,7 @@ class Auth extends BaseCollector * * @var string */ - protected $title = 'Shield'; + protected $title = 'Auth'; private ShieldAuth $auth; From 7611900181a140b4eaea040bad33cbdc364e6ac2 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Wed, 15 Mar 2023 12:10:46 +0330 Subject: [PATCH 5/5] fix: remove `v` from version Co-authored-by: kenjis --- src/Auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Auth.php b/src/Auth.php index c67ee804a..4ec710a5a 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -28,7 +28,7 @@ class Auth /** * The current version of CodeIgniter Shield */ - public const SHIELD_VERSION = 'v1.0.0-beta.5'; + public const SHIELD_VERSION = '1.0.0-beta.5'; protected Authentication $authenticate;