From f736a4aaf1fb9c0b96b679a25975d3212c0f9dc8 Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Wed, 16 Jan 2019 21:27:45 +0100 Subject: [PATCH] Allow "APP_ENV" and "APP_DEBUG" server/env variables set in bootstrap to affect kernel arguments --- .../configuring_application_kernel.feature | 46 +++++++++++++++++++ src/ServiceContainer/SymfonyExtension.php | 3 +- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/features/configuration/configuring_application_kernel.feature b/features/configuration/configuring_application_kernel.feature index 4033ebe..4d43179 100644 --- a/features/configuration/configuring_application_kernel.feature +++ b/features/configuration/configuring_application_kernel.feature @@ -130,6 +130,29 @@ Feature: Configuring application kernel When I run Behat Then it should pass + Scenario: Using environment based on a server variable set in the bootstrap file + Given a feature file containing: + """ + Feature: + Scenario: + And the application kernel should have environment "custom" + """ + And a Behat configuration containing: + """ + default: + extensions: + FriendsOfBehat\SymfonyExtension: + bootstrap: config/bootstrap.php + """ + And a bootstrap file "config/bootstrap.php" containing: + """ + setParameter('fob_symfony.bootstrap', $config['bootstrap']); + $this->processBootstrap($this->autodiscoverBootstrap($config['bootstrap'])); $this->loadKernel($container, $this->autodiscoverKernelConfiguration($config['kernel'])); $this->loadDriverKernel($container); @@ -86,7 +86,6 @@ final class SymfonyExtension implements Extension public function process(ContainerBuilder $container): void { - $this->processBootstrap($this->autodiscoverBootstrap($container->getParameter('fob_symfony.bootstrap'))); } private function registerMinkDriver(ExtensionManager $extensionManager): void