Index: trunk/phase3/tests/phpunit/includes/BlockTest.php |
— | — | @@ -27,6 +27,10 @@ |
28 | 28 | $user->saveSettings(); |
29 | 29 | } |
30 | 30 | |
| 31 | + $this->createBlock( 100500 ); |
| 32 | + } |
| 33 | + |
| 34 | + private function createBlock( $expiry ) { |
31 | 35 | // Delete the last round's block if it's still there |
32 | 36 | $oldBlock = Block::newFromTarget( 'UTBlockee' ); |
33 | 37 | if ( $oldBlock ) { |
— | — | @@ -35,7 +39,7 @@ |
36 | 40 | } |
37 | 41 | |
38 | 42 | $this->block = new Block( 'UTBlockee', 1, 0, |
39 | | - 'Parce que' |
| 43 | + 'Parce que', 0, false, time() + $expiry |
40 | 44 | ); |
41 | 45 | $this->madeAt = wfTimestamp( TS_MW ); |
42 | 46 | |
— | — | @@ -75,6 +79,8 @@ |
76 | 80 | * per bug 26425 |
77 | 81 | */ |
78 | 82 | function testBug26425BlockTimestampDefaultsToTime() { |
| 83 | + $this->createBlock( 0 ); |
| 84 | + |
79 | 85 | // delta to stop one-off errors when things happen to go over a second mark. |
80 | 86 | $delta = abs( $this->madeAt - $this->block->mTimestamp ); |
81 | 87 | $this->assertLessThan( 2, $delta, "If no timestamp is specified, the block is recorded as time()"); |