Description
What are you trying to achieve?
Run tests in Symfony's PROD environment.
What do you get instead?
Tests are still run in TEST environment.
Details
To investigate this, I created a controller which just outputs the environment (return new Response($kernel->getEnvironment());
). When browsing to its url I get whatever I have in Symfony's .env
. Fine.
When I access the url with codeception (codecept_debug($I->grabPageSource());
), I get whatever I write into functional.suite.yml
, even an arbitrary string like foo
.
However, if I put prod
, the app isn't really run in PROD environment. The feature I want to test is if the correct error page is shown. But in DEV/TEST environment Symfony always shows its internal Exception Page, not my own error page (see https://symfony.com/doc/current/controller/error_pages.html#testing-error-pages-during-development ) - that's how I know that I am still in TEST environment in fact.
I even tried with a @prepare
annotation ($symfony->_reconfigure(['environment' => 'prod']);
) to switch just for this single test (cause that's what I originally intended).
- Codeception version: 2.5.2
- Symfony version: 4.2.1
- Suite configuration:
actor: FunctionalTester
modules:
enabled:
- Symfony:
app_path: 'src'
environment: 'prod'