8000 [HttpKernel] Fixed failing Stopwatch tests due to usleep() accuracy o… · DavidChristmann/symfony@a4e0697 · GitHub
[go: up one dir, main page]

Skip to content

Commit a4e0697

Browse files
committed
[HttpKernel] Fixed failing Stopwatch tests due to usleep() accuracy on Windows
1 parent 1a5e0ac commit a4e0697

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchEventTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testTotalTime()
6969
usleep(10000);
7070
$event->stop();
7171
$total = $event->getTotalTime();
72-
$this->assertTrue($total >= 10 && $total <= 20);
72+
$this->assertTrue($total >= 9 && $total <= 20);
7373

7474
$event = new StopwatchEvent(microtime(true) * 1000);
7575
$event->start();
@@ -79,7 +79,7 @@ public function testTotalTime()
7979
usleep(10000);
8080
$event->stop();
8181
$total = $event->getTotalTime();
82-
$this->assertTrue($total >= 20 && $total <= 30);
82+
$this->assertTrue($total >= 18 && $total <= 30);
8383
}
8484

8585
/**
@@ -101,7 +101,7 @@ public function testEnsureStopped()
101101
usleep(10000);
102102
$event->ensureStopped();
103103
$total = $event->getTotalTime();
104-
$this->assertTrue($total >= 30 && $total <= 40);
104+
$this->assertTrue($total >= 27 && $total <= 40);
105105
}
106106

107107
public function testStartTime()
@@ -139,6 +139,6 @@ public function testEndTime()
139139
usleep(10000);
140140
$event->stop();
141141
$end = $event->getEndTime();
142-
$this->assertTrue($end >= 20 && $end <= 30);
142+
$this->assertTrue($end >= 18 && $end <= 30);
143143
}
144144
}

tests/Symfony/Tests/Component/HttpKernel/Debug/StopwatchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testStop()
3838

3939
$this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event);
4040
$total = $event->getTotalTime();
41-
$this->assertTrue($total >= 10 && $total <= 20);
41+
$this->assertTrue($total >= 9 && $total <= 20);
4242
}
4343

4444
public function testLap()
@@ -52,7 +52,7 @@ public function testLap()
5252

5353
$this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event);
5454
$total = $event->getTotalTime();
55-
$this->assertTrue($total >= 20 && $total <= 30);
55+
$this->assertTrue($total >= 18 && $total <= 30);
5656
}
5757

5858
/**

0 commit comments

Comments
 (0)
0