From 3c290c6b969d562fa0b46e24ec701eab4e2caa9f Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Mon, 26 Mar 2018 20:08:22 +0300 Subject: [PATCH] Stop test from randomly failing The difference between two integers is less than 1 only if it's 0, so the test as-is will fail whenever the second changes between when '1 day' is evaluated when inserting the block, and when time() is called for the assert. Change-Id: Ic76ff05729129b74345696879a934253525213fa --- tests/phpunit/includes/api/ApiBlockTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php index c0cf87eedf..c456e9abbb 100644 --- a/tests/phpunit/includes/api/ApiBlockTest.php +++ b/tests/phpunit/includes/api/ApiBlockTest.php @@ -207,7 +207,7 @@ class ApiBlockTest extends ApiTestCase { ); // Allow flakiness up to one second - $this->assertLessThan( 1, + $this->assertLessThanOrEqual( 1, abs( wfTimestamp( TS_UNIX, $expiry ) - ( time() + 86400 ) ) ); } -- 2.20.1