8000 minor #23347 [Dotenv] clean up before running assertions (xabbuh) · symfony/symfony@10120cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 10120cf

Browse files
committed
minor #23347 [Dotenv] clean up before running assertions (xabbuh)
This PR was merged into the 3.3 branch. Discussion ---------- [Dotenv] clean up before running assertions | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | If one of the assertions failed, the clean up part would never happen. Commits ------- baafc7b [Dotenv] clean up before running assertions
2 parents 8b6cb57 + baafc7b commit 10120cf

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ public function getEnvData()
148148

149149
public function testLoad()
150150
{
151+
unset($_ENV['FOO']);
152+
unset($_ENV['BAR']);
153+
unset($_SERVER['FOO']);
154+
unset($_SERVER['BAR']);
155+
putenv('FOO');
156+
putenv('BAR');
157+
151158
@mkdir($tmpdir = sys_get_temp_dir().'/dotenv');
152159

153160
$path1 = tempnam($tmpdir, 'sf-');
@@ -158,14 +165,17 @@ public function testLoad()
158165

159166
(new DotEnv())->load($path1, $path2);
160167

161-
$this->assertSame('BAR', getenv('FOO'));
162-
$this->assertSame('BAZ', getenv('BAR'));
168+
$foo = getenv('FOO');
169+
$bar = getenv('BAR');
163170

164171
putenv('FOO');
165172
putenv('BAR');
166173
unlink($path1);
167174
unlink($path2);
168175
rmdir($tmpdir);
176+
177+
$this->assertSame('BAR', $foo);
178+
$this->assertSame('BAZ', $bar);
169179
}
170180

171181
/**

0 commit comments

Comments
 (0)
0