mirror of
https://github.com/symfony/recipes.git
synced 2026-09-12 07:36:30 +03:00
Load .env.dist when it exists and .env is not found
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.7/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.5/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
|
||||
@@ -114,7 +114,11 @@ class Kernel extends BaseKernel
|
||||
|
||||
private static function loadEnv(Dotenv $dotenv, $path)
|
||||
{
|
||||
$dotenv->load($path);
|
||||
if (file_exists($path) || !file_exists($p = "$path.dist")) {
|
||||
$dotenv->load($path);
|
||||
} else {
|
||||
$dotenv->load($p);
|
||||
}
|
||||
|
||||
if (null === $env = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null)) {
|
||||
$dotenv->populate(array('APP_ENV' => $env = 'dev'));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.5/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
|
||||
Reference in New Issue
Block a user