You are here

public function AbstractProcessTest::testCallbacksAreExecutedWithStart 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::testCallbacksAreExecutedWithStart()

File

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

Class

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

Namespace

Symfony\Component\Process\Tests

Code

public function testCallbacksAreExecutedWithStart() {
  $data = '';
  $process = $this
    ->getProcess('echo foo && php -r "sleep(1);" && echo foo');
  $process
    ->start(function ($type, $buffer) use (&$data) {
    $data .= $buffer;
  });
  while ($process
    ->isRunning()) {
    usleep(10000);
  }
  $this
    ->assertEquals(2, preg_match_all('/foo/', $data, $matches));
}