File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ private function publishConfig(): void
8383 {
8484 $ this ->publishConfigAuth ();
8585 $ this ->publishConfigAuthGroups ();
86+ $ this ->publishConfigAuthToken ();
8687
8788 $ this ->setupHelper ();
8889 $ this ->setupRoutes ();
@@ -131,6 +132,18 @@ private function publishConfigAuthGroups(): void
131132 $ this ->copyAndReplace ($ file , $ replaces );
132133 }
133134
135+ private function publishConfigAuthToken (): void
136+ {
137+ $ file = 'Config/AuthToken.php ' ;
138+ $ replaces = [
139+ 'namespace CodeIgniter\Shield\Config ' => 'namespace Config ' ,
140+ 'use CodeIgniter \\Config \\BaseConfig; ' => 'use CodeIgniter \\Shield \\Config \\AuthToken as ShieldAuthToken; ' ,
141+ 'extends BaseConfig ' => 'extends ShieldAuthToken ' ,
142+ ];
143+
144+ $ this ->copyAndReplace ($ file , $ replaces );
145+ }
146+
134147 /**
135148 * Write a file, catching any exceptions and showing a
136149 * nicely formatted error.
Original file line number Diff line number Diff line change @@ -68,6 +68,10 @@ public function testRun(): void
6868 $ this ->assertStringContainsString ('namespace Config; ' , $ auth );
6969 $ this ->assertStringContainsString ('use CodeIgniter\Shield\Config\Auth as ShieldAuth; ' , $ auth );
7070
71+ $ authToken = file_get_contents ($ appFolder . 'Config/AuthToken.php ' );
72+ $ this ->assertStringContainsString ('namespace Config; ' , $ authToken );
73+ $ this ->assertStringContainsString ('use CodeIgniter\Shield\Config\AuthToken as ShieldAuthToken; ' , $ authToken );
74+
7175 $ routes = file_get_contents ($ appFolder . 'Config/Routes.php ' );
7276 $ this ->assertStringContainsString ('service( \'auth \')->routes($routes); ' , $ routes );
7377
@@ -79,6 +83,7 @@ public function testRun(): void
7983 $ this ->assertStringContainsString (
8084 ' Created: vfs://root/Config/Auth.php
8185 Created: vfs://root/Config/AuthGroups.php
86+ Created: vfs://root/Config/AuthToken.php
8287 Updated: vfs://root/Controllers/BaseController.php
8388 Updated: vfs://root/Config/Routes.php
8489 Updated: We have updated file \'vfs://root/Config/Security.php \' for security reasons. ' ,
You can’t perform that action at this time.
0 commit comments