public function ProcessBuilderTest::testProcessShouldInheritAndOverrideEnvironmentVars

File

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

Class

ProcessBuilderTest

Namespace

Symfony\Component\Process\Tests

Code

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