phpunit: Use assertEquals(, $delta) in UserTest instead of greater/lessThan
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 4 Jan 2017 03:29:35 +0000 (19:29 -0800)
committerKrinkle <krinklemail@gmail.com>
Wed, 4 Jan 2017 04:03:44 +0000 (04:03 +0000)
Follows-up 9d8358e09.

Documented at
https://phpunit.de/manual/4.8/en/appendixes.assertions.html#appendixes.assertions.assertEquals

Change-Id: Id337626c069663883d6a4bde58432637d33eb8c0

tests/phpunit/includes/user/UserTest.php

index 5d9cda7..8b9d11b 100644 (file)
@@ -726,13 +726,11 @@ class UserTest extends MediaWikiTestCase {
                $this->assertArrayHasKey( 'wm_infinite_blockBlockID', $cookies );
                $expOneDay = wfTimestamp() + ( 24 * 60 * 60 );
                // Check for expiry dates in a 10-second window, to account for slow testing.
-               $this->assertGreaterThan(
-                       $expOneDay - 5,
-                       $cookies['wm_infinite_blockBlockID']['expire']
-               );
-               $this->assertLessThan(
-                       $expOneDay + 5,
-                       $cookies['wm_infinite_blockBlockID']['expire']
+               $this->assertEquals(
+                       $expOneDay,
+                       $cookies['wm_infinite_blockBlockID']['expire'],
+                       'Expiry date',
+                       5.0
                );
 
                // 3. Change the block's expiry (to 2 hours), and the cookie's should be changed also.