19 return new ApiLogin( $main, $action );
35 [ $this,
'newApiLogin' ],
42 function (
ApiMain $main, $action ) {
54 $moduleManager->addModule(
$name, $group, $class, $factory );
56 $this->assertTrue( $moduleManager->isDefined(
$name, $group ),
'isDefined' );
57 $this->assertNotNull( $moduleManager->getModule(
$name, $group,
true ),
'getModule' );
79 'factory' => [ $this,
'newApiLogin' ],
83 'factory' =>
function (
ApiMain $main, $action ) {
98 $moduleManager->addModules(
$modules, $group );
101 $this->assertTrue( $moduleManager->isDefined(
$name, $group ),
'isDefined' );
102 $this->assertNotNull( $moduleManager->getModule(
$name, $group,
true ),
'getModule' );
105 $this->assertTrue(
true );
114 'factory' => [ $this,
'newApiLogin' ],
118 'factory' =>
function (
ApiMain $main, $action ) {
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 );
186 $moduleManager->addModules(
$modules,
'test' );
188 $this->assertNull( $moduleManager->getModule(
'quux' ),
'unknown name' );
189 $this->assertNull( $moduleManager->getModule(
'login',
'bla' ),
'wrong group' );
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 );
233 $moduleManager->addModules( $fooModules,
'foo' );
234 $moduleManager->addModules( $barModules,
'bar' );
236 $fooNamesWithClasses = $moduleManager->getNamesWithClasses(
'foo' );
239 $allNamesWithClasses = $moduleManager->getNamesWithClasses();
240 $allModules = array_merge( $fooModules, [
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' ) );
285 $moduleManager->addModules( $fooModules,
'foo' );
286 $moduleManager->addModules( $barModules,
'bar' );
288 $groups = $moduleManager->getGroups();
307 $moduleManager->addModules( $fooModules,
'foo' );
308 $moduleManager->addModules( $barModules,
'bar' );
312 $moduleManager->getClassName(
'login' )
316 $moduleManager->getClassName(
'logout' )
320 $moduleManager->getClassName(
'feedcontributions' )
324 $moduleManager->getClassName(
'feedrecentchanges' )
327 $moduleManager->getClassName(
'nonexistentmodule' )