MediaWiki  master
ApiBlockTest Class Reference

API Database medium. More...

Inheritance diagram for ApiBlockTest:
Collaboration diagram for ApiBlockTest:

Public Member Functions

 testBlockByBlockedUser ()
 A blocked user can't block. More...
 
 testBlockById ()
 Block by user ID. More...
 
 testBlockingActionWithNoToken ()
 ApiUsageException The "token" parameter must be set. More...
 
 testBlockingTooManyPageRestrictions ()
 ApiUsageException Too many values supplied for parameter "pagerestrictions". More...
 
 testBlockOfNonexistentUser ()
 
 testBlockOfNonexistentUserId ()
 
 testBlockWithEmailBlock ()
 
 testBlockWithExpiry ()
 
 testBlockWithHide ()
 
 testBlockWithInvalidExpiry ()
 
 testBlockWithLargeRange ()
 ApiUsageException Invalid value "127.0.0.1/64" for user parameter "user". More...
 
 testBlockWithoutRestrictions ()
 
 testBlockWithProhibitedEmailBlock ()
 
 testBlockWithProhibitedHide ()
 
 testBlockWithProhibitedTag ()
 
 testBlockWithRestrictions ()
 
 testBlockWithTag ()
 
 testNormalBlock ()
 Block by username. More...
 
 testRangeBlock ()
 
 testVeryLargeRangeBlock ()
 ApiUsageException Range blocks larger than /16 are not allowed. More...
 
- Public Member Functions inherited from ApiTestCase
 testApiTestGroup ()
 

Protected Member Functions

 getTokens ()
 
 setUp ()
 
- Protected Member Functions inherited from ApiTestCase
 doApiRequest (array $params, array $session=null, $appendModule=false, User $user=null, $tokenType=null)
 Does the API request and returns the result. More...
 
 doApiRequestWithToken (array $params, array $session=null, User $user=null, $tokenType='auto')
 Convenience function to access the token parameter of doApiRequest() more succinctly. More...
 
 doLogin ( $testUser=null)
 Previously this would do API requests to log in, as well as setting $wgUser and the request context's user. More...
 
 getTokenList (TestUser $user, $session=null)
 
 setExpectedApiException ( $msg, $code=null, array $data=null, $httpCode=0)
 Expect an ApiUsageException to be thrown with the given parameters, which are the same as ApiUsageException::newWithMessage()'s parameters. More...
 
 setUp ()
 
 tearDown ()
 
- Protected Member Functions inherited from MediaWikiLangTestCase
 setUp ()
 

Protected Attributes

 $mUser = null
 
- Protected Attributes inherited from ApiTestCase
ApiTestContext $apiContext
 

Private Member Functions

 doBlock (array $extraParams=[], User $blocker=null)
 

Additional Inherited Members

- Static Public Member Functions inherited from ApiTestCase
static apiExceptionHasCode (ApiUsageException $ex, $code)
 
- Static Protected Member Functions inherited from ApiTestCase
static getErrorFormatter ()
 
- Static Protected Attributes inherited from ApiTestCase
static $apiUrl
 
static $errorFormatter = null
 

Detailed Description

API Database medium.

ApiBlock

Definition at line 14 of file ApiBlockTest.php.

Member Function Documentation

◆ doBlock()

◆ getTokens()

ApiBlockTest::getTokens ( )
protected

◆ setUp()

ApiBlockTest::setUp ( )
protected

Definition at line 17 of file ApiBlockTest.php.

◆ testBlockByBlockedUser()

ApiBlockTest::testBlockByBlockedUser ( )

A blocked user can't block.

Definition at line 91 of file ApiBlockTest.php.

References class, doBlock(), and MediaWiki\Block\DatabaseBlock\insert().

◆ testBlockById()

ApiBlockTest::testBlockById ( )

Block by user ID.

Definition at line 84 of file ApiBlockTest.php.

References doBlock().

◆ testBlockingActionWithNoToken()

ApiBlockTest::testBlockingActionWithNoToken ( )

ApiUsageException The "token" parameter must be set.

Definition at line 284 of file ApiBlockTest.php.

References ApiTestCase\doApiRequest(), and null.

◆ testBlockingTooManyPageRestrictions()

ApiBlockTest::testBlockingTooManyPageRestrictions ( )

ApiUsageException Too many values supplied for parameter "pagerestrictions".

The limit is 10.

Definition at line 322 of file ApiBlockTest.php.

References $tokens, ApiTestCase\doApiRequest(), getTokens(), and null.

◆ testBlockOfNonexistentUser()

ApiBlockTest::testBlockOfNonexistentUser ( )

Definition at line 108 of file ApiBlockTest.php.

References class, and doBlock().

◆ testBlockOfNonexistentUserId()

ApiBlockTest::testBlockOfNonexistentUserId ( )

Definition at line 115 of file ApiBlockTest.php.

References class, doBlock(), and User\whoIs().

◆ testBlockWithEmailBlock()

ApiBlockTest::testBlockWithEmailBlock ( )

Definition at line 184 of file ApiBlockTest.php.

References $res, DB_MASTER, doBlock(), and wfGetDB().

◆ testBlockWithExpiry()

ApiBlockTest::testBlockWithExpiry ( )

Definition at line 220 of file ApiBlockTest.php.

References $res, DB_MASTER, doBlock(), wfGetDB(), and wfTimestamp().

◆ testBlockWithHide()

ApiBlockTest::testBlockWithHide ( )

Definition at line 158 of file ApiBlockTest.php.

References $res, $wgGroupPermissions, DB_MASTER, doBlock(), and wfGetDB().

◆ testBlockWithInvalidExpiry()

ApiBlockTest::testBlockWithInvalidExpiry ( )

Definition at line 236 of file ApiBlockTest.php.

References class, and doBlock().

◆ testBlockWithLargeRange()

ApiBlockTest::testBlockWithLargeRange ( )

ApiUsageException Invalid value "127.0.0.1/64" for user parameter "user".

Definition at line 301 of file ApiBlockTest.php.

References $tokens, ApiTestCase\doApiRequest(), getTokens(), and null.

◆ testBlockWithoutRestrictions()

ApiBlockTest::testBlockWithoutRestrictions ( )

Definition at line 242 of file ApiBlockTest.php.

References doBlock().

◆ testBlockWithProhibitedEmailBlock()

ApiBlockTest::testBlockWithProhibitedEmailBlock ( )

Definition at line 202 of file ApiBlockTest.php.

References class, and doBlock().

◆ testBlockWithProhibitedHide()

ApiBlockTest::testBlockWithProhibitedHide ( )

Definition at line 177 of file ApiBlockTest.php.

References class, and doBlock().

◆ testBlockWithProhibitedTag()

ApiBlockTest::testBlockWithProhibitedTag ( )

Definition at line 144 of file ApiBlockTest.php.

References class, ChangeTags\defineTag(), and doBlock().

◆ testBlockWithRestrictions()

ApiBlockTest::testBlockWithRestrictions ( )

Definition at line 255 of file ApiBlockTest.php.

References $title, class, doBlock(), and NS_TALK.

◆ testBlockWithTag()

ApiBlockTest::testBlockWithTag ( )

Definition at line 125 of file ApiBlockTest.php.

References DB_MASTER, ChangeTags\defineTag(), doBlock(), and wfGetDB().

◆ testNormalBlock()

ApiBlockTest::testNormalBlock ( )

Block by username.

Definition at line 77 of file ApiBlockTest.php.

References doBlock().

◆ testRangeBlock()

ApiBlockTest::testRangeBlock ( )

Definition at line 344 of file ApiBlockTest.php.

References doBlock(), and User\newFromName().

◆ testVeryLargeRangeBlock()

ApiBlockTest::testVeryLargeRangeBlock ( )

ApiUsageException Range blocks larger than /16 are not allowed.

Definition at line 353 of file ApiBlockTest.php.

References doBlock(), and User\newFromName().

Member Data Documentation

◆ $mUser

ApiBlockTest::$mUser = null
protected

Definition at line 15 of file ApiBlockTest.php.


The documentation for this class was generated from the following file: