From 005d86f4dbe8fa31b941845af66cad5ed25c4115 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 23 Feb 2012 20:36:56 +0100 Subject: [PATCH] Broaden timer tests limits --- .../Component/HttpKernel/Debug/StopwatchEventTest.php | 10 +++++----- .../Tests/Component/HttpKernel/Debug/StopwatchTest.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchEventTest.php b/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchEventTest.php index 9ec05e5284..2ad56d992a 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchEventTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchEventTest.php @@ -66,10 +66,10 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase { $event = new StopwatchEvent(microtime(true) * 1000); $event->start(); - usleep(10000); + usleep(20000); $event->stop(); $total = $event->getTotalTime(); - $this->assertTrue($total >= 9 && $total <= 20); + $this->assertTrue($total > 10 && $total <= 29, $total.' should be 20 (between 10 and 29)'); $event = new StopwatchEvent(microtime(true) * 1000); $event->start(); @@ -79,7 +79,7 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase usleep(10000); $event->stop(); $total = $event->getTotalTime(); - $this->assertTrue($total >= 18 && $total <= 30); + $this->assertTrue($total > 10 && $total <= 29, $total.' should be 20 (between 10 and 29)'); } /** @@ -101,7 +101,7 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase usleep(10000); $event->ensureStopped(); $total = $event->getTotalTime(); - $this->assertTrue($total >= 27 && $total <= 40); + $this->assertTrue($total >= 21 && $total <= 39, $total.' should be 30 (between 21 and 39)'); } public function testStartTime() @@ -139,7 +139,7 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase usleep(10000); $event->stop(); $end = $event->getEndTime(); - $this->assertTrue($end >= 18 && $end <= 30); + $this->assertTrue($end > 10 && $end <= 29, $end.' should be 20 (between 10 and 29)'); } /** diff --git a/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchTest.php b/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchTest.php index 57d36f38c0..64f40766f7 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchTest.php @@ -33,12 +33,12 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase { $stopwatch = new Stopwatch(); $stopwatch->start('foo', 'cat'); - usleep(10000); + usleep(20000); $event = $stopwatch->stop('foo'); $this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event); $total = $event->getTotalTime(); - $this->assertTrue($total >= 9 && $total <= 20); + $this->assertTrue($total > 10 && $total <= 29, $total.' should be 20 (between 10 and 29)'); } public function testLap() @@ -52,7 +52,7 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase $this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event); $total = $event->getTotalTime(); - $this->assertTrue($total >= 18 && $total <= 30); + $this->assertTrue($total > 10 && $total <= 29, $total.' should be 20 (between 10 and 29)'); } /**