Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6b12e0

Browse files
committed
Change waitUntil test for windows
Windows is slow with processes. It makes the test fail. Let's make a special assertion for windows.
1 parent 2f6a96e commit f6b12e0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ public function waitUntil(callable $callback)
455455
$wait = true;
456456
do {
457457
$this->checkTimeout();
458-
$running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
459-
$output = $this->processPipes->readAndWrite($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
458+
$running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
459+
$output = $this->processPipes->readAndWrite($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
460460

461461
foreach ($output as $type => $data) {
462462
if (3 !== $type) {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ public function testWaitUntilSpecificOutput()
152152
$p->stop();
153153

154154
$this->assertEquals("First iteration output\nSecond iteration output\nOne more iteration output\n", $completeOutput);
155-
$this->assertLessThan(2, microtime(true) - $start);
155+
156+
if ('\\' === \DIRECTORY_SEPARATOR) {
157+
// Windows is slower
158+
$this->assertLessThan(15, microtime(true) - $start);
159+
} else {
160+
$this->assertLessThan(2, microtime(true) - $start);
161+
}
156162
}
157163

158164
public function testAllOutputIsActuallyReadOnTermination()

0 commit comments

Comments
 (0)