I have .env
, .env.test
, .env.test.local
files in my project.
Variables are specified in .env.test
:
APP_ENV=test
APP_DEBUG=1
However, when the test is running (WebTestCase
), these variables don’t seem to exist.
class ErrorListener
{
public function __construct(
protected Environment $twig,
protected ParameterBagInterface $parameters,
)
{
}
public function __invoke(ExceptionEvent $event): void
{
if ($this->parameters->get('APP_DEBUG')) { //APP_DEBUG is empty
return;
}
......
......
}
}
And APP_ENV
is empty too.
Why?
4