From 697487da5e2657fa3598ce9e60ee061b5545bd22 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Thu, 18 Aug 2011 06:23:44 +0000 Subject: [PATCH] Make testBug26425BlockTimestampDefaultsToTime be tolerrant of up to 2 seconds difference. Otherwise if the test happens to be run on a second barrier, it could falsely fail (like it did just now when codur said some hurtful things about my code failing unit-tests where it really didn't ;) Some of the other block tests seem to itermitantly fail for no appearent reason (null comes back instead of the block)... I don't know why. --- tests/phpunit/includes/BlockTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php index 8d9044517f..a5ec6c9b6b 100644 --- a/tests/phpunit/includes/BlockTest.php +++ b/tests/phpunit/includes/BlockTest.php @@ -75,8 +75,9 @@ class BlockTest extends MediaWikiLangTestCase { * per bug 26425 */ function testBug26425BlockTimestampDefaultsToTime() { - - $this->assertEquals( $this->madeAt, $this->block->mTimestamp, "If no timestamp is specified, the block is recorded as time()"); + // delta to stop one-off errors when things happen to go over a second mark. + $delta = abs( $this->madeAt - $this->block->mTimestamp ); + $this->assertLessThan( 2, $delta, "If no timestamp is specified, the block is recorded as time()"); } -- 2.20.1