ApiTestCase: Set correct user for derivate requests
authorMatthias Mullie <git@mullie.eu>
Fri, 5 Jun 2015 09:52:40 +0000 (11:52 +0200)
committerLegoktm <legoktm.wikipedia@gmail.com>
Fri, 5 Jun 2015 17:37:14 +0000 (17:37 +0000)
RequestContext::getMain()->getUser() in a (faux) API request doesn't return the
user the (faux) API call is made with, but the user running the tests.

Bug: T101388
Change-Id: Icbbf14a6433edf5c91162a9d67899d6a2d5c33df

tests/phpunit/includes/api/ApiTestCase.php

index da62bb0..21345ac 100644 (file)
@@ -105,6 +105,7 @@ abstract class ApiTestCase extends MediaWikiLangTestCase {
 
                $wgRequest = new FauxRequest( $params, true, $session );
                RequestContext::getMain()->setRequest( $wgRequest );
+               RequestContext::getMain()->setUser( $wgUser );
 
                // set up local environment
                $context = $this->apiContext->newTestContext( $wgRequest, $wgUser );