Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dabecde

Browse files
committed
[Dotenv] Test load() with multiple paths
1 parent 035d526 commit dabecde

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Symfony/Component/Dotenv/Tests/DotenvTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,28 @@ public function getEnvData()
146146
return $tests;
147147
}
148148

149+
public function testLoad()
150+
{
151+
@mkdir($tmpdir = sys_get_temp_dir().'/dotenv');
152+
153+
$path1 = tempnam($tmpdir, 'sf-');
154+
$path2 = tempnam($tmpdir, 'sf-');
155+
156+
file_put_contents($path1, 'FOO=BAR');
157+
file_put_contents($path2, 'BAR=BAZ');
158+
159+
(new DotEnv())->load($path1, $path2);
160+
161+
$this->assertSame('BAR', getenv('FOO'));
162+
$this->assertSame('BAZ', getenv('BAR'));
163+
164+
putenv('FOO');
165+
putenv('BAR');
166+
unlink($path1);
167+
unlink($path2);
168+
rmdir($tmpdir);
169+
}
170+
149171
/**
150172
* @expectedException \Symfony\Component\Dotenv\Exception\PathException
151173
*/

0 commit comments

Comments
 (0)