Skip to content

Commit d0dd8ce

Browse files
IchHabRechtsebastianbergmann
authored andcommitted
Ensure environment values are stored in $_ENV in \PHPUnit\Util\Configuration
1 parent 2a6f0aa commit d0dd8ce

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Util/Configuration.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ public function handlePHPConfiguration()
568568
\putenv("{$name}={$value}");
569569
}
570570

571+
$value = \getenv($name);
572+
571573
if (!isset($_ENV[$name])) {
572574
$_ENV[$name] = $value;
573575
}

tests/Util/ConfigurationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public function testPHPConfigurationIsHandledCorrectly()
263263
$this->assertFalse(\FOO);
264264
$this->assertTrue(\BAR);
265265
$this->assertFalse($GLOBALS['foo']);
266-
$this->assertTrue($_ENV['foo']);
266+
$this->assertTrue((bool) $_ENV['foo']);
267267
$this->assertEquals(1, \getenv('foo'));
268268
$this->assertEquals('bar', $_POST['foo']);
269269
$this->assertEquals('bar', $_GET['foo']);
@@ -311,7 +311,7 @@ public function testHandlePHPConfigurationDoesNotOverriteVariablesFromPutEnv()
311311
\putenv('foo=putenv');
312312
$this->configuration->handlePHPConfiguration();
313313

314-
$this->assertTrue($_ENV['foo']);
314+
$this->assertEquals('putenv', $_ENV['foo']);
315315
$this->assertEquals('putenv', \getenv('foo'));
316316
}
317317

0 commit comments

Comments
 (0)