You are here

public function AbstractProcessTest::testSetStreamAsInput in Zircon Profile 8

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

@dataProvider pipesCodeProvider

File

vendor/symfony/process/Tests/AbstractProcessTest.php, line 173

Class

AbstractProcessTest
@author Robert Schönthal <seroscho@googlemail.com>

Namespace

Symfony\Component\Process\Tests

Code

public function testSetStreamAsInput($code, $size) {
  if ('\\' === DIRECTORY_SEPARATOR) {
    $this
      ->markTestIncomplete('This test fails with a timeout on Windows, can someone investigate please?');
  }
  $expected = str_repeat(str_repeat('*', 1024), $size) . '!';
  $expectedLength = 1024 * $size + 1;
  $stream = fopen('php://temporary', 'w+');
  fwrite($stream, $expected);
  rewind($stream);
  $p = $this
    ->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)), null, null, null, 5);
  $p
    ->setInput($stream);
  $p
    ->run();
  fclose($stream);
  $this
    ->assertEquals($expectedLength, strlen($p
    ->getOutput()));
  $this
    ->assertEquals($expectedLength, strlen($p
    ->getErrorOutput()));
}