public function testSetCacheModeUnrecognized() {
$api = new ApiMain();
$api->setCacheMode( 'unrecognized' );
- $this->resetServices();
$this->assertSame(
'private',
TestingAccessWrapper::newFromObject( $api )->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;