Skip to content

Commit

Permalink
Fix .env loading in development (archtechx#799)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
erikgaal authored and viicslen committed Feb 17, 2022
1 parent cb5f0b1 commit 31abc3c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ protected function setUp(): void
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([
Expand Down

0 comments on commit 31abc3c

Please sign in to comment.