aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/api/ApiTestCase.php
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2018-04-12 19:54:51 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2018-04-12 19:54:51 +0000
commit54d50ef3921dc9f30dc4d863ddc471dc564998e9 (patch)
treeddd7f3455668a4b97e52611abd644425508f8252 /tests/phpunit/includes/api/ApiTestCase.php
parent9a3e888d65e886cf7f88957aaebd3d10d7856728 (diff)
parent5ab1bee6bcf83bd133b48c79fd72da92f58037d4 (diff)
downloadmediawikicore-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.php6
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 );
}