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 "(bug 40353) SpecialDoubleRedirect: Fix for interwiki redirects"
[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
f81bb6d
..
3cec99a
100644
(file)
--- a/
tests/phpunit/includes/api/ApiTestCase.php
+++ b/
tests/phpunit/includes/api/ApiTestCase.php
@@
-1,10
+1,6
@@
<?php
abstract class ApiTestCase extends MediaWikiLangTestCase {
<?php
abstract class ApiTestCase extends MediaWikiLangTestCase {
- /**
- * @var Array of ApiTestUser
- */
- public static $users;
protected static $apiUrl;
/**
protected static $apiUrl;
/**
@@
-22,14
+18,16
@@
abstract class ApiTestCase extends MediaWikiLangTestCase {
$wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' );
$wgRequest = new FauxRequest( array() );
$wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' );
$wgRequest = new FauxRequest( array() );
+ ApiQueryInfo::resetTokenCache(); // tokens are invalid because we cleared the session
+
self::$users = array(
self::$users = array(
- 'sysop' => new
Api
TestUser(
+ 'sysop' => new TestUser(
'Apitestsysop',
'Api Test Sysop',
'api_test_sysop@example.com',
array( 'sysop' )
),
'Apitestsysop',
'Api Test Sysop',
'api_test_sysop@example.com',
array( 'sysop' )
),
- 'uploader' => new
Api
TestUser(
+ 'uploader' => new TestUser(
'Apitestuser',
'Api Test User',
'api_test_user@example.com',
'Apitestuser',
'Api Test User',
'api_test_user@example.com',
@@
-85,10
+83,16
@@
abstract class ApiTestCase extends MediaWikiLangTestCase {
* This is cheating a bit -- we grab a token in the correct format and then add it to the pseudo-session and to the
* request, without actually requesting a "real" edit token
* @param $params Array: key-value API params
* This is cheating a bit -- we grab a token in the correct format and then add it to the pseudo-session and to the
* request, without actually requesting a "real" edit token
* @param $params Array: key-value API params
- * @param $session Array: session array
+ * @param $session Array
|null
: session array
* @param $user User|null A User object for the context
*/
* @param $user User|null A User object for the context
*/
- protected function doApiRequestWithToken( Array $params, Array $session, User $user = null ) {
+ protected function doApiRequestWithToken( Array $params, Array $session = null, User $user = null ) {
+ global $wgRequest;
+
+ if ( $session === null ) {
+ $session = $wgRequest->getSessionArray();
+ }
+
if ( $session['wsToken'] ) {
// add edit token to fake session
$session['wsEditToken'] = $session['wsToken'];
if ( $session['wsToken'] ) {
// add edit token to fake session
$session['wsEditToken'] = $session['wsToken'];
@@
-122,7
+126,7
@@
abstract class ApiTestCase extends MediaWikiLangTestCase {
$data = $this->doApiRequest( array(
'action' => 'query',
'titles' => 'Main Page',
$data = $this->doApiRequest( array(
'action' => 'query',
'titles' => 'Main Page',
- 'intoken' => 'edit|delete|protect|move|block|unblock',
+ 'intoken' => 'edit|delete|protect|move|block|unblock
|watch
',
'prop' => 'info' ), $session, false, $user->user );
return $data;
}
'prop' => 'info' ), $session, false, $user->user );
return $data;
}