diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2018-04-12 19:54:51 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2018-04-12 19:54:51 +0000 |
commit | 54d50ef3921dc9f30dc4d863ddc471dc564998e9 (patch) | |
tree | ddd7f3455668a4b97e52611abd644425508f8252 /tests/phpunit/includes/api/ApiTestCase.php | |
parent | 9a3e888d65e886cf7f88957aaebd3d10d7856728 (diff) | |
parent | 5ab1bee6bcf83bd133b48c79fd72da92f58037d4 (diff) | |
download | mediawikicore-54d50ef3921dc9f30dc4d863ddc471dc564998e9.tar.gz mediawikicore-54d50ef3921dc9f30dc4d863ddc471dc564998e9.zip |
Merge "Test ApiUserrights"
Diffstat (limited to 'tests/phpunit/includes/api/ApiTestCase.php')
-rw-r--r-- | tests/phpunit/includes/api/ApiTestCase.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/phpunit/includes/api/ApiTestCase.php b/tests/phpunit/includes/api/ApiTestCase.php index 6506ea4df0b2..a5ee7ddb8c9f 100644 --- a/tests/phpunit/includes/api/ApiTestCase.php +++ b/tests/phpunit/includes/api/ApiTestCase.php @@ -121,6 +121,10 @@ abstract class ApiTestCase extends MediaWikiLangTestCase { } if ( $tokenType !== null ) { + if ( $tokenType === 'auto' ) { + $tokenType = ( new ApiMain() )->getModuleManager() + ->getModule( $params['action'], 'action' )->needsToken(); + } $params['token'] = ApiQueryTokens::getToken( $wgUser, $sessionObj, ApiQueryTokens::getTokenTypeSalts()[$tokenType] )->toString(); @@ -164,7 +168,7 @@ abstract class ApiTestCase extends MediaWikiLangTestCase { * @return array Result of the API call */ protected function doApiRequestWithToken( array $params, array $session = null, - User $user = null, $tokenType = 'csrf' + User $user = null, $tokenType = 'auto' ) { return $this->doApiRequest( $params, $session, false, $user, $tokenType ); } |