You are here

public function ProcessBuilderTest::testProcessShouldInheritAndOverrideEnvironmentVars in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/process/Tests/ProcessBuilderTest.php \Symfony\Component\Process\Tests\ProcessBuilderTest::testProcessShouldInheritAndOverrideEnvironmentVars()

File

vendor/symfony/process/Tests/ProcessBuilderTest.php, line 51

Class

ProcessBuilderTest

Namespace

Symfony\Component\Process\Tests

Code

public function testProcessShouldInheritAndOverrideEnvironmentVars() {
  $_ENV['MY_VAR_1'] = 'foo';
  $proc = ProcessBuilder::create()
    ->setEnv('MY_VAR_1', 'bar')
    ->add('foo')
    ->getProcess();
  unset($_ENV['MY_VAR_1']);
  $env = $proc
    ->getEnv();
  $this
    ->assertArrayHasKey('MY_VAR_1', $env);
  $this
    ->assertEquals('bar', $env['MY_VAR_1']);
}