From 5a3fcb028046ef0c599f6d9419791bdb31951b93 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 18 Feb 2016 21:06:04 +0000 Subject: [PATCH] Timing: Fix flaky TimingTest test > 1) TimingTest::testMark > Failed asserting that 1455828402.4503 is greater than 1455828402.4503. Use usleep(100), similar to the other tests already there. Change-Id: Ic45c99b7e928df397809d872ab8e41ada6ecf1e7 --- tests/phpunit/includes/libs/TimingTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/includes/libs/TimingTest.php b/tests/phpunit/includes/libs/TimingTest.php index aa60101bcd..4d71944004 100644 --- a/tests/phpunit/includes/libs/TimingTest.php +++ b/tests/phpunit/includes/libs/TimingTest.php @@ -55,6 +55,7 @@ class TimingTest extends PHPUnit_Framework_TestCase { $this->assertArrayHasKey( 'startTime', $entry ); $this->assertEquals( 0, $entry['duration'] ); + usleep( 100 ); $timing->mark( 'a' ); $newEntry = $timing->getEntryByName( 'a' ); $this->assertGreaterThan( $entry['startTime'], $newEntry['startTime'] ); @@ -67,9 +68,10 @@ class TimingTest extends PHPUnit_Framework_TestCase { $timing = new Timing; $timing->mark( 'a' ); - $a = $timing->getEntryByName( 'a' ); - + usleep( 100 ); $timing->mark( 'b' ); + + $a = $timing->getEntryByName( 'a' ); $b = $timing->getEntryByName( 'b' ); $timing->measure( 'a_to_b', 'a', 'b' ); -- 2.20.1