minor #14247 [Process] Fix volatile test (nicolas-grekas)
This PR was merged into the 2.6 branch.
Discussion
----------
[Process] Fix volatile test
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #14078
| License | MIT
| Doc PR | -
This PR hopefully fixes this remaining and most frequent volatile test.
Commits
-------
dae1942
[Process] Fix volatile test
This commit is contained in:
commit
b66c9347cb
@ -800,9 +800,6 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertFalse($process->isSuccessful());
|
$this->assertFalse($process->isSuccessful());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group idle-timeout
|
|
||||||
*/
|
|
||||||
public function testIdleTimeout()
|
public function testIdleTimeout()
|
||||||
{
|
{
|
||||||
$process = $this->getProcess('php -r "sleep(3);"');
|
$process = $this->getProcess('php -r "sleep(3);"');
|
||||||
@ -820,21 +817,18 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group idle-timeout
|
|
||||||
*/
|
|
||||||
public function testIdleTimeoutNotExceededWhenOutputIsSent()
|
public function testIdleTimeoutNotExceededWhenOutputIsSent()
|
||||||
{
|
{
|
||||||
$process = $this->getProcess('php -r "echo \'foo\'; sleep(1); echo \'foo\'; sleep(1); echo \'foo\'; sleep(1); "');
|
$process = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 30; while ($n--) {echo "foo\n"; usleep(100000); }')));
|
||||||
$process->setTimeout(2);
|
$process->setTimeout(2);
|
||||||
$process->setIdleTimeout(1.5);
|
$process->setIdleTimeout(1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$process->run();
|
$process->run();
|
||||||
$this->fail('A timeout exception was expected.');
|
$this->fail('A timeout exception was expected.');
|
||||||
} catch (ProcessTimedOutException $ex) {
|
} catch (ProcessTimedOutException $ex) {
|
||||||
$this->assertTrue($ex->isGeneralTimeout());
|
$this->assertTrue($ex->isGeneralTimeout(), 'A general timeout is expected.');
|
||||||
$this->assertFalse($ex->isIdleTimeout());
|
$this->assertFalse($ex->isIdleTimeout(), 'No idle timeout is expected.');
|
||||||
$this->assertEquals(2, $ex->getExceededTimeout());
|
$this->assertEquals(2, $ex->getExceededTimeout());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase
|
|||||||
$event->start();
|
$event->start();
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
$event->stop();
|
$event->stop();
|
||||||
|
usleep(50000);
|
||||||
$event->start();
|
$event->start();
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
$event->stop();
|
$event->stop();
|
||||||
@ -93,6 +94,7 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase
|
|||||||
$event->start();
|
$event->start();
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
$event->stop();
|
$event->stop();
|
||||||
|
usleep(50000);
|
||||||
$event->start();
|
$event->start();
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
$this->assertEquals(100, $event->getDuration(), null, self::DELTA);
|
$this->assertEquals(100, $event->getDuration(), null, self::DELTA);
|
||||||
|
Reference in New Issue
Block a user