From: Timo Tijhof Date: Thu, 18 Feb 2016 21:06:04 +0000 (+0000) Subject: Timing: Fix flaky TimingTest test X-Git-Tag: 1.31.0-rc.0~7905^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/message.php?a=commitdiff_plain;h=5a3fcb028046ef0c599f6d9419791bdb31951b93;p=lhc%2Fweb%2Fwiklou.git 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 --- 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' );