return $result;
}
+ /**
+ * Returns the class name of the given module
+ *
+ * @param string $module Module name
+ * @return string|bool class name or false if the module does not exist
+ * @since 1.24
+ */
+ public function getClassName( $module ) {
+ if ( isset( $this->mModules[$module] ) ) {
+ return $this->mModules[$module][1];
+ }
+
+ return false;
+ }
+
/**
* Returns true if the specific module is defined at all or in a specific group.
* @param string $moduleName Module name
$this->assertArrayEquals( array( 'foo', 'bar' ), $groups );
}
+ /**
+ * @covers ApiModuleManager::getClassName
+ */
+ public function testGetClassName() {
+ $fooModules = array(
+ 'login' => 'ApiLogin',
+ 'logout' => 'ApiLogout',
+ );
+
+ $barModules = array(
+ 'feedcontributions' => array( 'class' => 'ApiFeedContributions' ),
+ 'feedrecentchanges' => array( 'class' => 'ApiFeedRecentChanges' ),
+ );
+
+ $moduleManager = $this->getModuleManager();
+ $moduleManager->addModules( $fooModules, 'foo' );
+ $moduleManager->addModules( $barModules, 'bar' );
+
+ $this->assertEquals( 'ApiLogin', $moduleManager->getClassName( 'login' ) );
+ $this->assertEquals( 'ApiLogout', $moduleManager->getClassName( 'logout' ) );
+ $this->assertEquals( 'ApiFeedContributions', $moduleManager->getClassName( 'feedcontributions' ) );
+ $this->assertEquals( 'ApiFeedRecentChanges', $moduleManager->getClassName( 'feedrecentchanges' ) );
+ $this->assertFalse( $moduleManager->getClassName( 'nonexistentmodule' ) );
+ }
+
+
}