8000 [Process] Fix volatile test · symfony/symfony@dae1942 · GitHub
[go: up one dir, main page]

Skip to content

Commit dae1942

Browse files
[Process] Fix volatile test
1 parent 0430d20 commit dae1942

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,6 @@ public function testCheckTimeoutOnStartedProcess()
800800
$this->assertFalse($process->isSuccessful());
801801
}
802802

803-
/**
804-
* @group idle-timeout
805-
*/
806803
public function testIdleTimeout()
807804
{
808805
$process = $this->getProcess('php -r "sleep(3);"');
@@ -820,21 +817,18 @@ public function testIdleTimeout()
820817
}
821818
}
822819

823-
/**
824-
* @group idle-timeout
825-
*/
826820
public function testIdleTimeoutNotExceededWhenOutputIsSent()
827821
{
828-
$process = $this->getProcess('php -r "echo \'foo\'; sleep(1); echo \'foo\'; sleep(1); echo \'foo\'; sleep(1); "');
822+
$process = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 30; while ($n--) {echo "foo\n"; usleep(100000); }')));
829823
$process->setTimeout(2);
830-
$process->setIdleTimeout(1.5);
824+
$process->setIdleTimeout(1);
831825

832826
try {
833827
$process->run();
834828
$this->fail('A timeout exception was expected.');
835829
} catch (ProcessTimedOutException $ex) {
836-
$this->assertTrue($ex->isGeneralTimeout());
837-
$this->assertFalse($ex->isIdleTimeout());
830+
$this->assertTrue($ex->isGeneralTimeout(), 'A general timeout is expected.');
831+
$this->assertFalse($ex->isIdleTimeout(), 'No idle timeout is expected.');
838832
$this->assertEquals(2, $ex->getExceededTimeout());
839833
}
840834
}

src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public function testDuration()
7676
$event->start();
7777
usleep(100000);
7878
$event->stop();
79+
usleep(50000);
7980
$event->start();
8081
usleep(100000);
8182
$event->stop();
@@ -93,6 +94,7 @@ public function testDurationBeforeStop()
9394
$event->start();
9495
usleep(100000);
9596
$event->stop();
97+
usleep(50000);
9698
$event->start();
9799
usleep(100000);
98100
$this->assertEquals(100, $event->getDuration(), null, self::DELTA);

0 commit comments

Comments
 (0)
0