From 31abc3c52cd60454e217d2952cd14494bb64edb5 Mon Sep 17 00:00:00 2001 From: Erik Gaal Date: Mon, 14 Feb 2022 14:31:01 +0100 Subject: [PATCH] Fix .env loading in development (#799) * Upgrade vlucas/phpdotenv to ^5.0 `Dotenv::create($paths)` was the syntax for releases before v4 * Remove vlucas/phpdotenv dependency and make it work with newer versions. --- tests/TestCase.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index bbc42489..d3e42ea1 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -48,7 +48,11 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase protected function getEnvironmentSetUp($app) { if (file_exists(__DIR__ . '/../.env')) { - \Dotenv\Dotenv::create(__DIR__ . '/..')->load(); + if (method_exists(\Dotenv\Dotenv::class, 'createImmutable')) { + \Dotenv\Dotenv::createImmutable(__DIR__ . '/..')->load(); + } else { + \Dotenv\Dotenv::create(__DIR__ . '/..')->load(); + } } $app['config']->set([