summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/api/ApiBlockTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /tests/phpunit/includes/api/ApiBlockTest.php
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'tests/phpunit/includes/api/ApiBlockTest.php')
-rw-r--r--tests/phpunit/includes/api/ApiBlockTest.php21
1 files changed, 7 insertions, 14 deletions
diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php
index 94643b10..8afb748a 100644
--- a/tests/phpunit/includes/api/ApiBlockTest.php
+++ b/tests/phpunit/includes/api/ApiBlockTest.php
@@ -6,7 +6,6 @@
* @group medium
*/
class ApiBlockTest extends ApiTestCase {
-
protected function setUp() {
parent::setUp();
$this->doLogin();
@@ -35,9 +34,8 @@ class ApiBlockTest extends ApiTestCase {
* Which made the Block/Unblock API to actually verify the token
* previously always considered valid (bug 34212).
*/
- function testMakeNormalBlock() {
-
- $data = $this->getTokens();
+ public function testMakeNormalBlock() {
+ $tokens = $this->getTokens();
$user = User::newFromName( 'UTApiBlockee' );
@@ -45,19 +43,15 @@ class ApiBlockTest extends ApiTestCase {
$this->markTestIncomplete( "The user UTApiBlockee does not exist" );
}
- if ( !isset( $data[0]['query']['pages'] ) ) {
+ if ( !array_key_exists( 'blocktoken', $tokens ) ) {
$this->markTestIncomplete( "No block token found" );
}
- $keys = array_keys( $data[0]['query']['pages'] );
- $key = array_pop( $keys );
- $pageinfo = $data[0]['query']['pages'][$key];
-
- $data = $this->doApiRequest( array(
+ $this->doApiRequest( array(
'action' => 'block',
'user' => 'UTApiBlockee',
'reason' => 'Some reason',
- 'token' => $pageinfo['blocktoken'] ), null, false, self::$users['sysop']->user );
+ 'token' => $tokens['blocktoken'] ), null, false, self::$users['sysop']->user );
$block = Block::newFromTarget( 'UTApiBlockee' );
@@ -66,7 +60,6 @@ class ApiBlockTest extends ApiTestCase {
$this->assertEquals( 'UTApiBlockee', (string)$block->getTarget() );
$this->assertEquals( 'Some reason', $block->mReason );
$this->assertEquals( 'infinity', $block->mExpiry );
-
}
/**
@@ -77,7 +70,7 @@ class ApiBlockTest extends ApiTestCase {
* @dataProvider provideBlockUnblockAction
* @expectedException UsageException
*/
- function testBlockingActionWithNoToken( $action ) {
+ public function testBlockingActionWithNoToken( $action ) {
$this->doApiRequest(
array(
'action' => $action,
@@ -93,7 +86,7 @@ class ApiBlockTest extends ApiTestCase {
/**
* Just provide the 'block' and 'unblock' action to test both API calls
*/
- function provideBlockUnblockAction() {
+ public static function provideBlockUnblockAction() {
return array(
array( 'block' ),
array( 'unblock' ),