Skip to content

Commit 227b85b

Browse files
committed
[Process] Fix some unit tests that create the process object instead of delegate it to the implementation
1 parent 53a0403 commit 227b85b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/Process/Tests/AbstractProcessTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ public function testCallbackIsExecutedForOutput()
166166

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

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

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

179179
$p->start();
180180
while ($p->isRunning()) {
@@ -185,15 +185,15 @@ public function testGetIncrementalErrorOutput()
185185

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

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

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

198198
$p->start();
199199
while ($p->isRunning()) {

0 commit comments

Comments
 (0)