[HttpKernel] Fixed failing Stopwatch tests due to usleep() accuracy on Windows

This commit is contained in:
Arnout Boks 2011-11-27 13:18:15 +01:00
parent 1a5e0acd02
commit a4e0697f39
2 changed files with 6 additions and 6 deletions

View File

@ -69,7 +69,7 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase
usleep(10000);
$event->stop();
$total = $event->getTotalTime();
$this->assertTrue($total >= 10 && $total <= 20);
$this->assertTrue($total >= 9 && $total <= 20);
$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 >= 20 && $total <= 30);
$this->assertTrue($total >= 18 && $total <= 30);
}
/**
@ -101,7 +101,7 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase
usleep(10000);
$event->ensureStopped();
$total = $event->getTotalTime();
$this->assertTrue($total >= 30 && $total <= 40);
$this->assertTrue($total >= 27 && $total <= 40);
}
public function testStartTime()
@ -139,6 +139,6 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase
usleep(10000);
$event->stop();
$end = $event->getEndTime();
$this->assertTrue($end >= 20 && $end <= 30);
$this->assertTrue($end >= 18 && $end <= 30);
}
}

View File

@ -38,7 +38,7 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event);
$total = $event->getTotalTime();
$this->assertTrue($total >= 10 && $total <= 20);
$this->assertTrue($total >= 9 && $total <= 20);
}
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 >= 20 && $total <= 30);
$this->assertTrue($total >= 18 && $total <= 30);
}
/**