From a3b2f943390f09d752c305516c12e21436de9bda Mon Sep 17 00:00:00 2001
From: Alejandro Celaya <alejandrocelaya@gmail.com>
Date: Tue, 12 Sep 2023 08:21:34 +0200
Subject: [PATCH] Make sure local config is not loaded in tests

---
 composer.json     | 2 +-
 config/config.php | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/composer.json b/composer.json
index 8f76670b..ab187f55 100644
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,7 @@
         "ext-json": "*",
         "ext-pdo": "*",
         "akrabat/ip-address-middleware": "^2.1",
-        "cakephp/chronos": "^2.3",
+        "cakephp/chronos": "~2.3.3",
         "doctrine/migrations": "^3.5",
         "doctrine/orm": "^2.14",
         "endroid/qr-code": "^4.7",
diff --git a/config/config.php b/config/config.php
index e0ec6c23..9df29138 100644
--- a/config/config.php
+++ b/config/config.php
@@ -42,10 +42,9 @@ return (new ConfigAggregator\ConfigAggregator([
     Core\ConfigProvider::class,
     CLI\ConfigProvider::class,
     Rest\ConfigProvider::class,
-    new ConfigAggregator\PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
-    $isTestEnv
-        ? new ConfigAggregator\PhpFileProvider('config/test/*.global.php')
-        : new ConfigAggregator\ArrayProvider([]),
+    new ConfigAggregator\PhpFileProvider('config/autoload/{,*.}global.php'),
+    // Local config should not be loaded during tests, whereas test config should be loaded ONLY during tests
+    new ConfigAggregator\PhpFileProvider($isTestEnv ? 'config/test/*.global.php' : 'config/autoload/{,*.}local.php'),
     // Routes have to be loaded last
     new ConfigAggregator\PhpFileProvider('config/autoload/routes.config.php'),
 ], 'data/cache/app_config.php', [