Skip to content

Commit

Permalink
[Process] Fix some unit tests that create the process object instead …
Browse files Browse the repository at this point in the history
…of delegate it to the implementation
  • Loading branch information
romainneutron committed Mar 11, 2014
1 parent 53a0403 commit 227b85b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Symfony/Component/Process/Tests/AbstractProcessTest.php
Expand Up @@ -166,15 +166,15 @@ public function testCallbackIsExecutedForOutput()

public function testGetErrorOutput()
{
$p = new Process(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));

$p->run();
$this->assertEquals(3, preg_match_all('/ERROR/', $p->getErrorOutput(), $matches));
}

public function testGetIncrementalErrorOutput()
{
$p = new Process(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { usleep(50000); file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { usleep(50000); file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));

$p->start();
while ($p->isRunning()) {
Expand All @@ -185,15 +185,15 @@ public function testGetIncrementalErrorOutput()

public function testGetOutput()
{
$p = new Process(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) {echo \' foo \';$n++; usleep(500); }')));
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) {echo \' foo \';$n++; usleep(500); }')));

$p->run();
$this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches));
}

public function testGetIncrementalOutput()
{
$p = new Process(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) { echo \' foo \'; usleep(50000); $n++; }')));
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) { echo \' foo \'; usleep(50000); $n++; }')));

$p->start();
while ($p->isRunning()) {
Expand Down

0 comments on commit 227b85b

Please sign in to comment.