Fix review feedback

This commit is contained in:
Arnaud Langlade
2018-03-13 11:45:25 +01:00
parent b1059a520c
commit 1a39d31f5e
4 changed files with 21 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ before_install:
install:
- composer require symfony/http-kernel:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
- composer require symfony/dotenv:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
- composer require --dev symfony/framework-bundle:${SYMFONY_VERSION} --no-update --no-scripts --prefer-dist
- composer update --prefer-dist

View File

@@ -14,7 +14,7 @@
"behat/behat": "^3.1",
"symfony/http-kernel": "^3.3|^4.0",
"symfony/dotenv": "^4.0"
"symfony/dotenv": "^3.3|^4.0"
},
"require-dev": {
"behat/mink": "^1.7",

View File

@@ -67,6 +67,7 @@ Feature: Not crashing Behat
kernel:
path: src/MyKernel.php
class: MyKernel
bootstrap: ~
"""
And a file ".env_in_memory" containing:
"""

View File

@@ -61,6 +61,16 @@ final class SymfonyExtension implements Extension
*/
const SHARED_KERNEL_CONTAINER_ID = 'sylius_symfony_extension.shared_kernel.container';
/**
* Default symfony environment used to run your suites.
*/
private const DEFAULT_ENV = 'test';
/**
* Enable or disable the debug mode
*/
private const DEBUG_MODE = false;
/**
* @var CrossContainerProcessor|null
*/
@@ -115,10 +125,11 @@ final class SymfonyExtension implements Extension
if (null !== $config['env_file']) {
$this->loadEnvVars($container, $config['env_file']);
$environment = getenv('APP_ENV');
$config['kernel']['env'] = $environment ?? 'test';
} else {
$this->requireKernelBootstrapFile($container->getParameter('paths.base'), $config['bootstrap']);
$environment = false !== getenv('APP_ENV') ? getenv('APP_ENV') : self::DEFAULT_ENV;
$debugMode = false !== getenv('APP_DEBUG') ? getenv('APP_DEBUG') : self::DEBUG_MODE;
$config['kernel']['env'] = $environment;
$config['kernel']['kernel'] = $debugMode;
}
$this->loadKernel($container, $config['kernel']);
@@ -163,6 +174,8 @@ final class SymfonyExtension implements Extension
$definition->setFile($this->getKernelFile($container->getParameter('paths.base'), $config['path']));
$container->setDefinition(self::KERNEL_ID, $definition);
$this->requireKernelBootstrapFile($container->getParameter('paths.base'), $config['bootstrap']);
}
/**