From 0c5aa8bf7e47078804d87e475e1269f019f2afc4 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 24 May 2012 19:52:29 +0200 Subject: [PATCH] [Process] Add failing test for callbacks on windows --- src/Symfony/Component/Process/Tests/ProcessTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index d78955fcd4..c30d1bb80c 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -68,6 +68,18 @@ class ProcessTest extends \PHPUnit_Framework_TestCase $this->assertSame(0, $p->getExitCode()); } + public function testCallbackIsExecutedForOutput() + { + $p = new Process(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'); + } + public function testExitCodeText() { $process = new Process('');