diff --git a/src/Database/DatabaseConfig.php b/src/Database/DatabaseConfig.php index 67b1cd42..8b48ec72 100644 --- a/src/Database/DatabaseConfig.php +++ b/src/Database/DatabaseConfig.php @@ -137,8 +137,8 @@ class DatabaseConfig unset($config['password']); } - if (empty($config)) { - $config = $templateConnection; + if (! $config) { + return $templateConnection; } return array_replace($templateConnection, $config); diff --git a/tests/TenantDatabaseManagerTest.php b/tests/TenantDatabaseManagerTest.php index 5399f3de..cb79180a 100644 --- a/tests/TenantDatabaseManagerTest.php +++ b/tests/TenantDatabaseManagerTest.php @@ -112,7 +112,9 @@ test('the tenant connection is fully removed', function () { tenancy()->end(); - expect(array_keys(app('db')->getConnections()))->not()->toContain('tenant') + expect(array_keys(app('db')->getConnections())) + ->toContain('central') + ->not()->toContain('tenant') ->and(config('database.connections.tenant'))->toBeNull(); });