public function ProcessBuilderTest::testNotReplaceExplicitlySetVars

File

drupal/core/vendor/symfony/process/Symfony/Component/Process/Tests/ProcessBuilderTest.php, line 56

Class

ProcessBuilderTest

Namespace

Symfony\Component\Process\Tests

Code

public function testNotReplaceExplicitlySetVars() {
  $snapshot = $_ENV;
  $_ENV = array(
    'foo' => 'bar',
  );
  $expected = array(
    'foo' => 'baz',
  );
  $pb = new ProcessBuilder();
  $pb
    ->setEnv('foo', 'baz')
    ->inheritEnvironmentVariables()
    ->add('foo');
  $proc = $pb
    ->getProcess();
  $this
    ->assertEquals($expected, $proc
    ->getEnv(), '->inheritEnvironmentVariables() copies $_ENV');
  $_ENV = $snapshot;
}