Skip to content

Commit 5552808

Browse files
committed
minor #31405 [Dotenv] Test do not use putenv (xuanquynh)
This PR was merged into the 4.3-dev branch. Discussion ---------- [Dotenv] Test do not use putenv | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The related pull request is #31062. If the `$usePutenv` flag is set to `false`, `putenv` won't be executed. I just add a small test for this situation. Commits ------- 6d1a76e Test do not use putenv
2 parents e387854 + 6d1a76e commit 5552808

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,14 @@ public function testNoDeprecationWarning()
431431
$dotenv = new Dotenv(false);
432432
$this->assertInstanceOf(Dotenv::class, $dotenv);
433433
}
434+
435+
public function testDoNotUsePutenv()
436+
{
437+
$dotenv = new Dotenv(false);
438+
$dotenv->populate(['TEST_USE_PUTENV' => 'no']);
439+
440+
$this->assertSame('no', $_SERVER['TEST_USE_PUTENV']);
441+
$this->assertSame('no', $_ENV['TEST_USE_PUTENV']);
442+
$this->assertFalse(getenv('TEST_USE_PUTENV'));
443+
}
434444
}

0 commit comments

Comments
 (0)