From 3496f9d5793e87059244cf4efb986d3907a9e189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 18 Aug 2022 08:58:19 +0200 Subject: [PATCH] IBX-3451: [Behat] Removed depending on APP_ENV when loading Context services (#62) --- .../EzPlatformContentFormsExtension.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bundle/DependencyInjection/EzPlatformContentFormsExtension.php b/src/bundle/DependencyInjection/EzPlatformContentFormsExtension.php index e24fe133..dc02bbc3 100644 --- a/src/bundle/DependencyInjection/EzPlatformContentFormsExtension.php +++ b/src/bundle/DependencyInjection/EzPlatformContentFormsExtension.php @@ -21,8 +21,7 @@ public function load(array $configs, ContainerBuilder $container): void $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.yaml'); - $environment = $container->getParameter('kernel.environment'); - if (in_array($environment, ['behat', 'test'])) { + if ($this->shouldLoadTestServices($container)) { $loader->load('feature_contexts.yaml'); } } @@ -47,4 +46,10 @@ private function prependJMSTranslation(ContainerBuilder $container): void ], ]); } + + private function shouldLoadTestServices(ContainerBuilder $container): bool + { + return $container->hasParameter('ibexa.testing.browser.enabled') + && true === $container->getParameter('ibexa.testing.browser.enabled'); + } }