Clear token cache when resetting session.
authordaniel <daniel.kinzler@wikimedia.de>
Mon, 24 Sep 2012 13:07:36 +0000 (15:07 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Mon, 24 Sep 2012 13:07:36 +0000 (15:07 +0200)
ApiTestCase resets global session data in setup, invalidating any existing cookies.
ApiQueryInfo caches all tokens, these need to be cleared out so tokens are re-generated
to match the fresh session.

Until now, individual tests have been doing that, but there's no not to do this per
default.

Change-Id: Icefa362190c2e7d87d09bda30079255741824f55

tests/phpunit/includes/api/ApiTestCase.php

index b84292e..3cec99a 100644 (file)
@@ -18,6 +18,8 @@ abstract class ApiTestCase extends MediaWikiLangTestCase {
                $wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' );
                $wgRequest = new FauxRequest( array() );
 
+               ApiQueryInfo::resetTokenCache(); // tokens are invalid because we cleared the session
+
                self::$users = array(
                        'sysop' => new TestUser(
                                'Apitestsysop',