[Process] Increase tests speed
This commit is contained in:
parent
40c08c640e
commit
ae8481038e
@ -550,7 +550,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$process = $this->getProcess('sleep 3');
|
||||
$process->setTimeout(10);
|
||||
$process->setIdleTimeout(1);
|
||||
$process->setIdleTimeout(0.5);
|
||||
|
||||
try {
|
||||
$process->run();
|
||||
@ -559,7 +559,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
} catch (ProcessTimedOutException $ex) {
|
||||
$this->assertTrue($ex->isIdleTimeout());
|
||||
$this->assertFalse($ex->isGeneralTimeout());
|
||||
$this->assertEquals(1.0, $ex->getExceededTimeout());
|
||||
$this->assertEquals(0.5, $ex->getExceededTimeout());
|
||||
}
|
||||
}
|
||||
|
||||
@ -568,9 +568,9 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testIdleTimeoutNotExceededWhenOutputIsSent()
|
||||
{
|
||||
$process = $this->getProcess('echo "foo" && sleep 1 && echo "foo" && sleep 1 && echo "foo" && sleep 1 && echo "foo" && sleep 5');
|
||||
$process->setTimeout(5);
|
||||
$process->setIdleTimeout(3);
|
||||
$process = $this->getProcess('echo "foo" && sleep 1 && echo "foo" && sleep 1 && echo "foo" && sleep 1');
|
||||
$process->setTimeout(2);
|
||||
$process->setIdleTimeout(1.5);
|
||||
|
||||
try {
|
||||
$process->run();
|
||||
@ -578,14 +578,14 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
} catch (ProcessTimedOutException $ex) {
|
||||
$this->assertTrue($ex->isGeneralTimeout());
|
||||
$this->assertFalse($ex->isIdleTimeout());
|
||||
$this->assertEquals(5.0, $ex->getExceededTimeout());
|
||||
$this->assertEquals(2, $ex->getExceededTimeout());
|
||||
}
|
||||
}
|
||||
|
||||
public function testStartAfterATimeout()
|
||||
{
|
||||
$process = $this->getProcess('php -r "while (true) {echo \'\'; usleep(1000); }"');
|
||||
$process->setTimeout(0.1);
|
||||
$process->setTimeout(0.2);
|
||||
try {
|
||||
$process->run();
|
||||
$this->fail('An exception should have been raised.');
|
||||
@ -593,7 +593,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
$process->start();
|
||||
usleep(10000);
|
||||
usleep(1000);
|
||||
$process->stop();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user