19 return new ApiLogin( $main, $action );
35 [ $this,
'newApiLogin' ],
42 function (
ApiMain $main, $action ) {
52 public function testAddModule( $name, $group, $class, $factory =
null ) {
54 $moduleManager->addModule( $name, $group, $class, $factory );
56 $this->assertTrue( $moduleManager->isDefined( $name, $group ),
'isDefined' );
57 $this->assertNotNull( $moduleManager->getModule( $name, $group,
true ),
'getModule' );
69 'login' => ApiLogin::class,
70 'logout' => ApiLogout::class,
78 'class' => ApiLogin::class,
79 'factory' => [ $this,
'newApiLogin' ],
82 'class' => ApiLogout::class,
83 'factory' =>
function (
ApiMain $main, $action ) {
98 $moduleManager->addModules(
$modules, $group );
100 foreach ( array_keys(
$modules ) as $name ) {
101 $this->assertTrue( $moduleManager->isDefined( $name, $group ),
'isDefined' );
102 $this->assertNotNull( $moduleManager->getModule( $name, $group,
true ),
'getModule' );
105 $this->assertTrue(
true );
110 'feedrecentchanges' => ApiFeedRecentChanges::class,
111 'feedcontributions' => [
'class' => ApiFeedContributions::class ],
113 'class' => ApiLogin::class,
114 'factory' => [ $this,
'newApiLogin' ],
117 'class' => ApiLogout::class,
118 'factory' =>
function (
ApiMain $main, $action ) {
128 ApiFeedRecentChanges::class,
134 ApiFeedContributions::class,
157 $moduleManager->addModules(
$modules,
'test' );
160 $module1 = $moduleManager->getModule( $name,
null,
false );
161 $this->assertInstanceOf( $expectedClass, $module1 );
164 $module2 = $moduleManager->getModule( $name,
'test',
true );
165 $this->assertNotNull( $module2 );
168 $module3 = $moduleManager->getModule( $name,
null,
false );
169 $this->assertSame( $module1, $module3 );
172 $module4 = $moduleManager->getModule( $name,
null,
true );
173 $this->assertNotSame( $module1, $module4 );
181 'login' => ApiLogin::class,
182 'logout' => ApiLogout::class,
186 $moduleManager->addModules(
$modules,
'test' );
188 $this->assertNull( $moduleManager->getModule(
'quux' ),
'unknown name' );
189 $this->assertNull( $moduleManager->getModule(
'login',
'bla' ),
'wrong group' );
197 'login' => ApiLogin::class,
198 'logout' => ApiLogout::class,
202 'feedcontributions' => [
'class' => ApiFeedContributions::class ],
203 'feedrecentchanges' => [
'class' => ApiFeedRecentChanges::class ],
207 $moduleManager->addModules( $fooModules,
'foo' );
208 $moduleManager->addModules( $barModules,
'bar' );
210 $fooNames = $moduleManager->getNames(
'foo' );
213 $allNames = $moduleManager->getNames();
214 $allModules = array_merge( $fooModules, $barModules );
223 'login' => ApiLogin::class,
224 'logout' => ApiLogout::class,
228 'feedcontributions' => [
'class' => ApiFeedContributions::class ],
229 'feedrecentchanges' => [
'class' => ApiFeedRecentChanges::class ],
233 $moduleManager->addModules( $fooModules,
'foo' );
234 $moduleManager->addModules( $barModules,
'bar' );
236 $fooNamesWithClasses = $moduleManager->getNamesWithClasses(
'foo' );
239 $allNamesWithClasses = $moduleManager->getNamesWithClasses();
240 $allModules = array_merge( $fooModules, [
241 'feedcontributions' => ApiFeedContributions::class,
242 'feedrecentchanges' => ApiFeedRecentChanges::class,
252 'login' => ApiLogin::class,
253 'logout' => ApiLogout::class,
257 'feedcontributions' => [
'class' => ApiFeedContributions::class ],
258 'feedrecentchanges' => [
'class' => ApiFeedRecentChanges::class ],
262 $moduleManager->addModules( $fooModules,
'foo' );
263 $moduleManager->addModules( $barModules,
'bar' );
265 $this->assertEquals(
'foo', $moduleManager->getModuleGroup(
'login' ) );
266 $this->assertEquals(
'bar', $moduleManager->getModuleGroup(
'feedrecentchanges' ) );
267 $this->assertNull( $moduleManager->getModuleGroup(
'quux' ) );
275 'login' => ApiLogin::class,
276 'logout' => ApiLogout::class,
280 'feedcontributions' => [
'class' => ApiFeedContributions::class ],
281 'feedrecentchanges' => [
'class' => ApiFeedRecentChanges::class ],
285 $moduleManager->addModules( $fooModules,
'foo' );
286 $moduleManager->addModules( $barModules,
'bar' );
288 $groups = $moduleManager->getGroups();
297 'login' => ApiLogin::class,
298 'logout' => ApiLogout::class,
302 'feedcontributions' => [
'class' => ApiFeedContributions::class ],
303 'feedrecentchanges' => [
'class' => ApiFeedRecentChanges::class ],
307 $moduleManager->addModules( $fooModules,
'foo' );
308 $moduleManager->addModules( $barModules,
'bar' );
312 $moduleManager->getClassName(
'login' )
316 $moduleManager->getClassName(
'logout' )
319 ApiFeedContributions::class,
320 $moduleManager->getClassName(
'feedcontributions' )
323 ApiFeedRecentChanges::class,
324 $moduleManager->getClassName(
'feedrecentchanges' )
327 $moduleManager->getClassName(
'nonexistentmodule' )
Unit to authenticate log-in attempts to the current wiki.
API module to allow users to log out of the wiki.
This is the main API class, used for both external and internal processing.
testGetModule_null()
ApiModuleManager::getModule.
newApiLogin( $main, $action)
testGetModule( $modules, $name, $expectedClass)
ApiModuleManager::getModule getModuleProvider.
testGetModuleGroup()
ApiModuleManager::getModuleGroup.
testAddModule( $name, $group, $class, $factory=null)
addModuleProvider
testGetNamesWithClasses()
ApiModuleManager::getNamesWithClasses.
testGetNames()
ApiModuleManager::getNames.
testGetClassName()
ApiModuleManager::getClassName.
testAddModules(array $modules, $group)
addModulesProvider
testGetGroups()
ApiModuleManager::getGroups.
This class holds a list of modules and handles instantiation.
WebRequest clone which takes values from a provided array.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request