public function testSetCacheModePrivateWiki() {
$this->setGroupPermissions( '*', 'read', false );
-
$wrappedApi = TestingAccessWrapper::newFromObject( new ApiMain() );
$wrappedApi->setCacheMode( 'public' );
$this->assertSame( 'private', $wrappedApi->mCacheMode );
$mock->method( 'needsToken' )->willReturn( true );
$api = new ApiMain( new FauxRequest( [ 'action' => 'testmodule' ] ) );
- $api->getModuleManager()->addModule( 'testmodule', 'action', get_class( $mock ),
- function () use ( $mock ) {
+ $api->getModuleManager()->addModule( 'testmodule', 'action', [
+ 'class' => get_class( $mock ),
+ 'factory' => function () use ( $mock ) {
return $mock;
}
- );
+ ] );
$api->execute();
}
$mock->method( 'mustBePosted' )->willReturn( false );
$api = new ApiMain( new FauxRequest( [ 'action' => 'testmodule' ] ) );
- $api->getModuleManager()->addModule( 'testmodule', 'action', get_class( $mock ),
- function () use ( $mock ) {
+ $api->getModuleManager()->addModule( 'testmodule', 'action', [
+ 'class' => get_class( $mock ),
+ 'factory' => function () use ( $mock ) {
return $mock;
}
- );
+ ] );
$api->execute();
}
$req->setRequestURL( "http://localhost" );
$api = new ApiMain( $req );
- $api->getModuleManager()->addModule( 'testmodule', 'action', get_class( $mock ),
- function () use ( $mock ) {
+ $api->getModuleManager()->addModule( 'testmodule', 'action', [
+ 'class' => get_class( $mock ),
+ 'factory' => function () use ( $mock ) {
return $mock;
}
- );
+ ] );
$wrapper = TestingAccessWrapper::newFromObject( $api );
$wrapper->mInternalMode = false;
} else {
$user = new User();
}
- $user->mRights = $rights;
+ $this->overrideUserPermissions( $user, $rights );
try {
$this->doApiRequest( [
'action' => 'query',