Skip to content

Commit

Permalink
minor #23245 [Dotenv] Test load() with multiple paths (chalasr)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.3 branch.

Discussion
----------

[Dotenv] Test load() with multiple paths

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23242 (comment)
| License       | MIT
| Doc PR        | n/a

Commits
-------

dabecde [Dotenv] Test load() with multiple paths
  • Loading branch information
fabpot committed Jun 21, 2017
2 parents 035d526 + dabecde commit 383c6ac
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Symfony/Component/Dotenv/Tests/DotenvTest.php
Expand Up @@ -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
*/
Expand Down

0 comments on commit 383c6ac

Please sign in to comment.