You are here

public function ProcessBuilderTest::testShouldEscapeArguments 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::testShouldEscapeArguments()

File

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

Class

ProcessBuilderTest

Namespace

Symfony\Component\Process\Tests

Code

public function testShouldEscapeArguments() {
  $pb = new ProcessBuilder(array(
    '%path%',
    'foo " bar',
    '%baz%baz',
  ));
  $proc = $pb
    ->getProcess();
  if ('\\' === DIRECTORY_SEPARATOR) {
    $this
      ->assertSame('^%"path"^% "foo \\" bar" "%baz%baz"', $proc
      ->getCommandLine());
  }
  else {
    $this
      ->assertSame("'%path%' 'foo \" bar' '%baz%baz'", $proc
      ->getCommandLine());
  }
}