-
Couldn't load subscription status.
- Fork 63
Description
The current documentation states:
It allows you to force using a given environment. If it is not set, it uses
APP_ENVenvironment variable if defined or falls back totest.
However, the current code does not implement this:
SymfonyExtension/src/ServiceContainer/SymfonyExtension.php
Lines 185 to 191 in dfb1c9c
| private function setupTestEnvironment(string $fallback): void | |
| { | |
| // If there's no defined server / environment variable with an environment, default to configured fallback | |
| if (($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) === null) { | |
| putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $fallback); | |
| } | |
| } |
The actual behavior of the code is to setup only if APP_ENV is not already defined (so not to force it) and the configuration value fallbacks to test (see
| $this->setupTestEnvironment($config['kernel']['environment'] ?? 'test'); |
I'm willing to submit a PR to fix this issue but wanted to know which way the maintainers want to move: fix the documentation that is misleading or fix the behavior in order to match the documentation?