From: Brian Wolff Date: Thu, 18 Aug 2011 06:23:44 +0000 (+0000) Subject: Make testBug26425BlockTimestampDefaultsToTime be tolerrant of up to 2 seconds X-Git-Tag: 1.31.0-rc.0~28191 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=697487da5e2657fa3598ce9e60ee061b5545bd22;p=lhc%2Fweb%2Fwiklou.git 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. --- 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()"); }