Stop test from randomly failing
authorAryeh Gregor <ayg@aryeh.name>
Mon, 26 Mar 2018 17:08:22 +0000 (20:08 +0300)
committerAryeh Gregor <ayg@aryeh.name>
Mon, 26 Mar 2018 17:08:22 +0000 (20:08 +0300)
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

index c0cf87e..c456e9a 100644 (file)
@@ -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 ) ) );
        }