Make sure local config is not loaded in tests

This commit is contained in:
Alejandro Celaya 2023-09-12 08:21:34 +02:00
parent b17c576a30
commit a3b2f94339
2 changed files with 4 additions and 5 deletions

View File

@ -18,7 +18,7 @@
"ext-json": "*", "ext-json": "*",
"ext-pdo": "*", "ext-pdo": "*",
"akrabat/ip-address-middleware": "^2.1", "akrabat/ip-address-middleware": "^2.1",
"cakephp/chronos": "^2.3", "cakephp/chronos": "~2.3.3",
"doctrine/migrations": "^3.5", "doctrine/migrations": "^3.5",
"doctrine/orm": "^2.14", "doctrine/orm": "^2.14",
"endroid/qr-code": "^4.7", "endroid/qr-code": "^4.7",

View File

@ -42,10 +42,9 @@ return (new ConfigAggregator\ConfigAggregator([
Core\ConfigProvider::class, Core\ConfigProvider::class,
CLI\ConfigProvider::class, CLI\ConfigProvider::class,
Rest\ConfigProvider::class, Rest\ConfigProvider::class,
new ConfigAggregator\PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'), new ConfigAggregator\PhpFileProvider('config/autoload/{,*.}global.php'),
$isTestEnv // Local config should not be loaded during tests, whereas test config should be loaded ONLY during tests
? new ConfigAggregator\PhpFileProvider('config/test/*.global.php') new ConfigAggregator\PhpFileProvider($isTestEnv ? 'config/test/*.global.php' : 'config/autoload/{,*.}local.php'),
: new ConfigAggregator\ArrayProvider([]),
// Routes have to be loaded last // Routes have to be loaded last
new ConfigAggregator\PhpFileProvider('config/autoload/routes.config.php'), new ConfigAggregator\PhpFileProvider('config/autoload/routes.config.php'),
], 'data/cache/app_config.php', [ ], 'data/cache/app_config.php', [