* @group API
* @group Database
* @group medium
+ *
+ * @covers ApiBlock
*/
class ApiBlockTest extends ApiTestCase {
protected function setUp() {
$this->doLogin();
}
- function getTokens() {
+ protected function getTokens() {
return $this->getTokenList( self::$users['sysop'] );
}
* Which made the Block/Unblock API to actually verify the token
* previously always considered valid (bug 34212).
*/
- function testMakeNormalBlock() {
+ public function testMakeNormalBlock() {
$tokens = $this->getTokens();
$user = User::newFromName( 'UTApiBlockee' );
}
/**
- * @dataProvider provideBlockUnblockAction
- */
- function testGetTokenUsingABlockingAction( $action ) {
- $data = $this->doApiRequest(
- array(
- 'action' => $action,
- 'user' => 'UTApiBlockee',
- 'gettoken' => '' ),
- null,
- false,
- self::$users['sysop']->user
- );
- $this->assertEquals( 34, strlen( $data[0][$action]["{$action}token"] ) );
- }
-
- /**
- * Attempting to block without a token should give a UsageException with
- * error message:
- * "The token parameter must be set"
- *
- * @dataProvider provideBlockUnblockAction
* @expectedException UsageException
+ * @expectedExceptionMessage The token parameter must be set
*/
- function testBlockingActionWithNoToken( $action ) {
+ public function testBlockingActionWithNoToken() {
$this->doApiRequest(
array(
- 'action' => $action,
+ 'action' => 'block',
'user' => 'UTApiBlockee',
'reason' => 'Some reason',
),
self::$users['sysop']->user
);
}
-
- /**
- * Just provide the 'block' and 'unblock' action to test both API calls
- */
- public static function provideBlockUnblockAction() {
- return array(
- array( 'block' ),
- array( 'unblock' ),
- );
- }
}