r101365 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101364‎ | r101365 | r101366 >
Date:16:54, 31 October 2011
Author:maxsem
Status:resolved (Comments)
Tags:
Comment:
Fixed annoying intermittent BlockTest failures. No surprise we had 'em since blocks set to expire RIGHT NOW tend to expire at that very time:)
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/BlockTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/BlockTest.php
@@ -27,6 +27,10 @@
2828 $user->saveSettings();
2929 }
3030
 31+ $this->createBlock( 100500 );
 32+ }
 33+
 34+ private function createBlock( $expiry ) {
3135 // Delete the last round's block if it's still there
3236 $oldBlock = Block::newFromTarget( 'UTBlockee' );
3337 if ( $oldBlock ) {
@@ -35,7 +39,7 @@
3640 }
3741
3842 $this->block = new Block( 'UTBlockee', 1, 0,
39 - 'Parce que'
 43+ 'Parce que', 0, false, time() + $expiry
4044 );
4145 $this->madeAt = wfTimestamp( TS_MW );
4246
@@ -75,6 +79,8 @@
7680 * per bug 26425
7781 */
7882 function testBug26425BlockTimestampDefaultsToTime() {
 83+ $this->createBlock( 0 );
 84+
7985 // delta to stop one-off errors when things happen to go over a second mark.
8086 $delta = abs( $this->madeAt - $this->block->mTimestamp );
8187 $this->assertLessThan( 2, $delta, "If no timestamp is specified, the block is recorded as time()");

Follow-up revisions

RevisionCommit summaryAuthorDate
r101366Simplify r101365, this cruft is not really neededmaxsem17:00, 31 October 2011

Comments

#Comment by 😂 (talk | contribs)   16:55, 31 October 2011

Wow...

Status & tagging log