Skip to content

Commit

Permalink
minor #10421 [Process] Fix some unit tests that create the process ob…
Browse files Browse the repository at this point in the history
…ject instead of delegate it to the implementation (romainneutron)

This PR was merged into the 2.3 branch.

Discussion
----------

[Process] Fix some unit tests that create the process object instead of delegate it to the implementation

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

This is a minor error ; creating the process must be delegated to the implementation

Commits
-------

227b85b [Process] Fix some unit tests that create the process object instead of delegate it to the implementation
  • Loading branch information
fabpot committed Mar 11, 2014
2 parents 53a0403 + 227b85b commit 2c55a2d
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 2c55a2d

Please sign in to comment.