dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Test ApiUserrights"
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
api
/
ApiTestCase.php
diff --git
a/tests/phpunit/includes/api/ApiTestCase.php
b/tests/phpunit/includes/api/ApiTestCase.php
index
6506ea4
..
a5ee7dd
100644
(file)
--- 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 !== null ) {
+ if ( $tokenType === 'auto' ) {
+ $tokenType = ( new ApiMain() )->getModuleManager()
+ ->getModule( $params['action'], 'action' )->needsToken();
+ }
$params['token'] = ApiQueryTokens::getToken(
$wgUser, $sessionObj, ApiQueryTokens::getTokenTypeSalts()[$tokenType]
)->toString();
$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,
* @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 );
}
) {
return $this->doApiRequest( $params, $session, false, $user, $tokenType );
}