minor #29015 [Process] fix transient test (nicolas-grekas)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Process] fix transient test

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

2f736a07fc [Process] fix transient test
This commit is contained in:
Nicolas Grekas 2018-10-29 12:09:57 +01:00
commit 41f57edf97

View File

@ -142,23 +142,12 @@ class ProcessTest extends TestCase
$completeOutput = '';
$result = $p->waitUntil(function ($type, $output) use (&$completeOutput) {
$completeOutput .= $output;
if (false !== strpos($output, 'One more')) {
return true;
}
return false;
return false !== strpos($completeOutput .= $output, 'One more');
});
$p->stop();
$this->assertTrue($result);
if ('\\' === \DIRECTORY_SEPARATOR) {
// Windows is slower
$this->assertLessThan(15, microtime(true) - $start);
} else {
$this->assertLessThan(2, microtime(true) - $start);
}
$this->assertEquals("First iteration output\nSecond iteration output\nOne more iteration output\n", $completeOutput);
$this->assertLessThan(20, microtime(true) - $start);
$this->assertStringStartsWith("First iteration output\nSecond iteration output\nOne more", $completeOutput);
$p->stop();
}
public function testWaitUntilCanReturnFalse()