From dabecdee9973a0a3b42c2bd45b8718bd30ce6bc1 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 21 Jun 2017 09:43:17 +0200 Subject: [PATCH] [Dotenv] Test load() with multiple paths --- .../Component/Dotenv/Tests/DotenvTest.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php index 85204e5c476a..fd0398f318a2 100644 --- a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php +++ b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php @@ -146,6 +146,28 @@ public function getEnvData() return $tests; } + public function testLoad() + { + @mkdir($tmpdir = sys_get_temp_dir().'/dotenv'); + + $path1 = tempnam($tmpdir, 'sf-'); + $path2 = tempnam($tmpdir, 'sf-'); + + file_put_contents($path1, 'FOO=BAR'); + file_put_contents($path2, 'BAR=BAZ'); + + (new DotEnv())->load($path1, $path2); + + $this->assertSame('BAR', getenv('FOO')); + $this->assertSame('BAZ', getenv('BAR')); + + putenv('FOO'); + putenv('BAR'); + unlink($path1); + unlink($path2); + rmdir($tmpdir); + } + /** * @expectedException \Symfony\Component\Dotenv\Exception\PathException */