From 9d9f1788b6b6da3083a12097459053ac02252d73 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:34:23 +0000 Subject: [PATCH 1/2] Fix installer tests and database connection check logic - Register CoreServiceProvider, QueryCacheServiceProvider and aliases in TestCase. - Fix EnvironmentController::checkDatabaseConnection to prevent overwriting default connection config. - Update EnvironmentPostTest to disable migrations and expect correct mock calls. Co-authored-by: juzaweb <47020363+juzaweb@users.noreply.github.com> --- .../Controllers/EnvironmentController.php | 29 +++++++++---------- tests/Feature/EnvironmentPostTest.php | 5 ++++ tests/TestCase.php | 17 +++++++++++ 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/Http/Controllers/EnvironmentController.php b/src/Http/Controllers/EnvironmentController.php index 73c051c..f117943 100644 --- a/src/Http/Controllers/EnvironmentController.php +++ b/src/Http/Controllers/EnvironmentController.php @@ -67,26 +67,25 @@ private function checkDatabaseConnection(Request $request) $settings = config("database.connections.{$connection}"); + if (!is_array($settings)) { + $settings = []; + } + config([ - 'database' => [ - 'default' => $connection, - 'connections' => [ - $connection => array_merge($settings, [ - 'driver' => $connection, - 'host' => $request->input('database_hostname'), - 'port' => $request->input('database_port'), - 'database' => $request->input('database_name'), - 'username' => $request->input('database_username'), - 'password' => $request->input('database_password'), - ]), - ], - ], + "database.connections.{$connection}" => array_merge($settings, [ + 'driver' => $connection, + 'host' => $request->input('database_hostname'), + 'port' => $request->input('database_port'), + 'database' => $request->input('database_name'), + 'username' => $request->input('database_username'), + 'password' => $request->input('database_password'), + ]), ]); - DB::purge(); + DB::purge($connection); try { - DB::connection()->getPdo(); + DB::connection($connection)->getPdo(); return true; } catch (Exception $e) { diff --git a/tests/Feature/EnvironmentPostTest.php b/tests/Feature/EnvironmentPostTest.php index 6e7505a..9b663fc 100644 --- a/tests/Feature/EnvironmentPostTest.php +++ b/tests/Feature/EnvironmentPostTest.php @@ -8,6 +8,11 @@ class EnvironmentPostTest extends TestCase { + protected function defineDatabaseMigrations(): void + { + // Do nothing to prevent migrations from running + } + /** @test */ public function it_validates_required_database_fields(): void { diff --git a/tests/TestCase.php b/tests/TestCase.php index 0f1a1a8..b02b470 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -21,10 +21,27 @@ protected function setUp(): void protected function getPackageProviders($app): array { return [ + \Juzaweb\Modules\Core\Providers\CoreServiceProvider::class, + \Juzaweb\QueryCache\QueryCacheServiceProvider::class, InstallerServiceProvider::class, ]; } + protected function getPackageAliases($app): array + { + return [ + 'Field' => \Juzaweb\Modules\Core\Facades\Field::class, + 'Module' => \Juzaweb\Modules\Core\Facades\Module::class, + 'Theme' => \Juzaweb\Modules\Core\Facades\Theme::class, + 'Widget' => \Juzaweb\Modules\Core\Facades\Widget::class, + 'Sidebar' => \Juzaweb\Modules\Core\Facades\Sidebar::class, + 'PageTemplate' => \Juzaweb\Modules\Core\Facades\PageTemplate::class, + 'PageBlock' => \Juzaweb\Modules\Core\Facades\PageBlock::class, + 'Chart' => \Juzaweb\Modules\Core\Facades\Chart::class, + 'Breadcrumb' => \Juzaweb\Modules\Core\Facades\Breadcrumb::class, + ]; + } + /** * Define environment setup. * From 22081a4b5c0de696071bfc702f8364e415c5d128 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:37:35 +0000 Subject: [PATCH 2/2] Fix CI workflow dependency installation - Update `.github/workflows/tests.yml` to use `--dev` flag when requiring `laravel/framework` and `orchestra/testbench`. This correctly installs these as development dependencies, avoiding the warning about moving packages from `require-dev` to `require`, and potentially resolving the flaky network error during composer update by triggering a new build. Co-authored-by: juzaweb <47020363+juzaweb@users.noreply.github.com> --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fbc3ce2..9a618c0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,7 +47,7 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --dev --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: List Installed Dependencies