From: Max Semenik Date: Mon, 31 Oct 2011 16:54:42 +0000 (+0000) Subject: Fixed annoying intermittent BlockTest failures. No surprise we had 'em since blocks... X-Git-Tag: 1.31.0-rc.0~26810 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=7e917c79b3d286e1c96c93c9241d80a4f50b3391;p=lhc%2Fweb%2Fwiklou.git Fixed annoying intermittent BlockTest failures. No surprise we had 'em since blocks set to expire RIGHT NOW tend to expire at that very time:) --- diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php index a5ec6c9b6b..54db18a42d 100644 --- a/tests/phpunit/includes/BlockTest.php +++ b/tests/phpunit/includes/BlockTest.php @@ -27,6 +27,10 @@ class BlockTest extends MediaWikiLangTestCase { $user->saveSettings(); } + $this->createBlock( 100500 ); + } + + private function createBlock( $expiry ) { // Delete the last round's block if it's still there $oldBlock = Block::newFromTarget( 'UTBlockee' ); if ( $oldBlock ) { @@ -35,7 +39,7 @@ class BlockTest extends MediaWikiLangTestCase { } $this->block = new Block( 'UTBlockee', 1, 0, - 'Parce que' + 'Parce que', 0, false, time() + $expiry ); $this->madeAt = wfTimestamp( TS_MW ); @@ -75,6 +79,8 @@ class BlockTest extends MediaWikiLangTestCase { * per bug 26425 */ function testBug26425BlockTimestampDefaultsToTime() { + $this->createBlock( 0 ); + // 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()");