From 21013f1692920a3aa24b26e840b2a066704b6eff Mon Sep 17 00:00:00 2001 From: pirs1337 Date: Sun, 19 Oct 2025 16:33:58 +0600 Subject: [PATCH 1/2] fix: adding middleware for telescope authorization refs: https://github.com/RonasIT/laravel-project-initializator/issues/38 --- src/Commands/InitCommand.php | 4 +-- tests/InitCommandTest.php | 48 ++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Commands/InitCommand.php b/src/Commands/InitCommand.php index 675a941..57a3146 100644 --- a/src/Commands/InitCommand.php +++ b/src/Commands/InitCommand.php @@ -245,14 +245,14 @@ public function handle(): void $this->setupComposerHooks(); - $this->changeMiddlewareForTelescopeAuthorization(); - $this->setAutoDocContactEmail($this->codeOwnerEmail); foreach ($this->shellCommands as $shellCommand) { shell_exec("{$shellCommand} --ansi"); } + $this->changeMiddlewareForTelescopeAuthorization(); + $this->publishWebLogin(); if ($this->shouldUninstallPackage) { diff --git a/tests/InitCommandTest.php b/tests/InitCommandTest.php index 61dda08..55d2279 100644 --- a/tests/InitCommandTest.php +++ b/tests/InitCommandTest.php @@ -12,18 +12,18 @@ public function testRunWithoutAdminAndReadmeCreationConvertAppNameToPascalCaseTe { $this->mockNativeFunction( '\RonasIT\ProjectInitializator\Extensions\ConfigWriter', - $this->callFileExists(base_path('config/telescope.php')), - $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), $this->callFileExists(base_path('config/auto-doc.php')), $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), ); $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_pascal_case.yml'), - $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), ); $this->mockNativeFunction( @@ -74,18 +74,18 @@ public function testRunWithoutAdminAndReadmeCreation() { $this->mockNativeFunction( '\RonasIT\ProjectInitializator\Extensions\ConfigWriter', - $this->callFileExists(base_path('config/telescope.php')), - $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), $this->callFileExists(base_path('config/auto-doc.php')), $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), ); $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env', 'env.example.yml', 'env.example_app_name_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_pascal_case.yml'), - $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), ); $this->mockNativeFunction( @@ -135,18 +135,18 @@ public function testRunWithAdminAndWithoutReadmeCreation() { $this->mockNativeFunction( '\RonasIT\ProjectInitializator\Extensions\ConfigWriter', - $this->callFileExists(base_path('config/telescope.php')), - $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), $this->callFileExists(base_path('config/auto-doc.php')), $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), ); $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), ); $this->mockNativeFunction( @@ -200,10 +200,10 @@ public function testRunWithAdminAndDefaultReadmeCreation() { $this->mockNativeFunction( '\RonasIT\ProjectInitializator\Extensions\ConfigWriter', - $this->callFileExists(base_path('config/telescope.php')), - $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), $this->callFileExists(base_path('config/auto-doc.php')), $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), ); $this->mockNativeFunction( @@ -212,8 +212,8 @@ public function testRunWithAdminAndDefaultReadmeCreation() $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development_app_name_not_pascal_case.yml', 'env.development_clerk_credentials_added.yml'), $this->changeEnvFileCall('.env.example', 'env.example_app_name_not_pascal_case.yml', 'env.example_clerk_credentials_added.yml'), - $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), ); $this->mockNativeFunction( @@ -335,18 +335,18 @@ public function testRunWithAdminAndPartialReadmeCreation() { $this->mockNativeFunction( '\RonasIT\ProjectInitializator\Extensions\ConfigWriter', - $this->callFileExists(base_path('config/telescope.php')), - $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), $this->callFileExists(base_path('config/auto-doc.php')), $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), ); $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), ); $this->mockNativeFunction( @@ -446,18 +446,18 @@ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorIns { $this->mockNativeFunction( '\RonasIT\ProjectInitializator\Extensions\ConfigWriter', - $this->callFileExists(base_path('config/telescope.php')), - $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), $this->callFileExists(base_path('config/auto-doc.php')), $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), ); $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), ); $this->mockNativeFunction( @@ -573,18 +573,18 @@ public function testRunWithoutAdminAndUsingTelescope() { $this->mockNativeFunction( '\RonasIT\ProjectInitializator\Extensions\ConfigWriter', - $this->callFileExists(base_path('config/telescope.php')), - $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), $this->callFileExists(base_path('config/auto-doc.php')), $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), ); $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), ); $this->mockNativeFunction( @@ -688,10 +688,10 @@ public function testRunWithClerkMobileAppWithPintInstalled(): void { $this->mockNativeFunction( '\RonasIT\ProjectInitializator\Extensions\ConfigWriter', - $this->callFileExists(base_path('config/telescope.php')), - $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), $this->callFileExists(base_path('config/auto-doc.php')), $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope_config.php')), ); $this->mockNativeFunction( @@ -700,8 +700,8 @@ public function testRunWithClerkMobileAppWithPintInstalled(): void $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development_app_name_not_pascal_case.yml', 'env.development_clerk_credentials_added_mobile_app.yml'), $this->changeEnvFileCall('.env.example', 'env.example_app_name_not_pascal_case.yml', 'env.example_clerk_credentials_added_mobile_app.yml'), - $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_config_after_initialization.php')), ); $this->mockNativeFunction( From 9438b939f6889759473484b9ab3dfe7ec55cf2fb Mon Sep 17 00:00:00 2001 From: pirs1337 Date: Mon, 3 Nov 2025 16:01:47 +0600 Subject: [PATCH 2/2] fix: conflicts refs: https://github.com/RonasIT/laravel-project-initializator/issues/38 --- tests/InitCommandTest.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/InitCommandTest.php b/tests/InitCommandTest.php index 594d834..46d1d9c 100644 --- a/tests/InitCommandTest.php +++ b/tests/InitCommandTest.php @@ -14,8 +14,8 @@ public function testRunWithoutAdminAndReadmeCreationConvertAppNameToPascalCaseTe '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_pascal_case.yml'), - $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), $this->changeConfigFileCall('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), ); $this->mockNativeFunction( @@ -68,8 +68,8 @@ public function testRunWithoutAdminAndReadmeCreation() '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env', 'env.example.yml', 'env.example_app_name_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_pascal_case.yml'), - $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), $this->changeConfigFileCall('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), ); $this->mockNativeFunction( @@ -121,8 +121,8 @@ public function testRunWithAdminAndWithoutReadmeCreation() '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), $this->changeConfigFileCall('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), ); $this->mockNativeFunction( @@ -180,8 +180,8 @@ public function testRunWithAdminAndDefaultReadmeCreation() $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development_app_name_not_pascal_case.yml', 'env.development_clerk_credentials_added.yml'), $this->changeEnvFileCall('.env.example', 'env.example_app_name_not_pascal_case.yml', 'env.example_clerk_credentials_added.yml'), - $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), $this->changeConfigFileCall('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), ); $this->mockNativeFunction( @@ -310,8 +310,8 @@ public function testRunWithAdminAndPartialReadmeCreation() '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), $this->changeConfigFileCall('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), ); $this->mockNativeFunction( @@ -413,8 +413,8 @@ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorIns '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), $this->changeConfigFileCall('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), ); $this->mockNativeFunction( @@ -535,8 +535,8 @@ public function testRunWithoutAdminAndUsingTelescope() '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), $this->changeConfigFileCall('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), ); $this->mockNativeFunction( @@ -650,8 +650,8 @@ public function testRunWithClerkMobileAppWithPintInstalled(): void $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development_app_name_not_pascal_case.yml', 'env.development_clerk_credentials_added_mobile_app.yml'), $this->changeEnvFileCall('.env.example', 'env.example_app_name_not_pascal_case.yml', 'env.example_clerk_credentials_added_mobile_app.yml'), - $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), $this->changeConfigFileCall('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), ); $this->mockNativeFunction( @@ -778,8 +778,8 @@ public function testRunWithClerkAdditionalAdminsWithoutDefaultAdmin(): void $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development_app_name_not_pascal_case.yml', 'env.development_clerk_credentials_added.yml'), $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_clerk_credentials_added.yml'), - $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), $this->changeConfigFileCall('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->changeConfigFileCall('config/telescope.php', 'telescope_config.php', 'telescope_config_after_initialization.php'), ); $this->mockNativeFunction(