summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/BlockTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
committerPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
commitd9022f63880ce039446fba8364f68e656b7bf4cb (patch)
tree16b40fbf17bf7c9ee6f4ead25b16dd192378050a /tests/phpunit/includes/BlockTest.php
parent27cf83d177256813e2e802241085fce5dd0f3fb9 (diff)
Update to MediaWiki 1.19.0
Diffstat (limited to 'tests/phpunit/includes/BlockTest.php')
-rw-r--r--tests/phpunit/includes/BlockTest.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php
index 2f224ba8..749f40b4 100644
--- a/tests/phpunit/includes/BlockTest.php
+++ b/tests/phpunit/includes/BlockTest.php
@@ -2,11 +2,10 @@
/**
* @group Database
+ * @group Blocking
*/
class BlockTest extends MediaWikiLangTestCase {
- const REASON = "Some reason";
-
private $block, $madeAt;
/* variable used to save up the blockID we insert in this test suite */
@@ -36,8 +35,8 @@ class BlockTest extends MediaWikiLangTestCase {
$oldBlock->delete();
}
- $this->block = new Block( 'UTBlockee', 1, 0,
- self::REASON
+ $this->block = new Block( 'UTBlockee', $user->getID(), 0,
+ 'Parce que', 0, false, time() + 100500
);
$this->madeAt = wfTimestamp( TS_MW );
@@ -68,7 +67,7 @@ class BlockTest extends MediaWikiLangTestCase {
// $this->dumpBlocks();
$this->assertTrue( $this->block->equals( Block::newFromTarget('UTBlockee') ), "newFromTarget() returns the same block as the one that was made");
-
+
$this->assertTrue( $this->block->equals( Block::newFromID( $this->blockId ) ), "newFromID() returns the same block as the one that was made");
}
@@ -77,8 +76,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()");
}
@@ -91,6 +91,8 @@ class BlockTest extends MediaWikiLangTestCase {
* @dataProvider dataBug29116
*/
function testBug29116LoadWithEmptyIp( $vagueTarget ) {
+ $this->hideDeprecated( 'Block::load' );
+
$uid = User::idFromName( 'UTBlockee' );
$this->assertTrue( ($uid > 0), 'Must be able to look up the target user during tests' );
@@ -121,4 +123,3 @@ class BlockTest extends MediaWikiLangTestCase {
);
}
}
-