public function AbstractProcessTest::testCallbackIsExecutedForOutput

File

drupal/core/vendor/symfony/process/Symfony/Component/Process/Tests/AbstractProcessTest.php, line 128

Class

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

Namespace

Symfony\Component\Process\Tests

Code

public function testCallbackIsExecutedForOutput() {
  $p = $this
    ->getProcess(sprintf('php -r %s', escapeshellarg('echo \'foo\';')));
  $called = false;
  $p
    ->run(function ($type, $buffer) use (&$called) {
    $called = $buffer === 'foo';
  });
  $this
    ->assertTrue($called, 'The callback should be executed with the output');
}