public function testInitCustomNamespace() { $test = array('wgLanguageCode' => 'en'); NamespaceManager::initCustomNamespace($test); $this->assertNotEmpty($test); $this->assertEquals(100, $test['smwgNamespaceIndex']); }
/** * @since 1.9 */ public function testInitCustomNamespace() { $test = array(); NamespaceManager::initCustomNamespace($test); $this->assertNotEmpty($test); $this->assertEquals(100, $test['smwgNamespaceIndex'], 'Asserts that smwgNamespaceIndex is being set to a default index'); }
/** * Function to switch on Semantic MediaWiki. This function must be called in * LocalSettings.php after including SMW_Settings.php. It is used to ensure * that required parameters for SMW are really provided explicitly. For * readability, this is the only global function that does not adhere to the * naming conventions. * * This function also sets up all autoloading, such that all SMW classes are * available as early on. Moreover, jobs and special pages are registered. * * @param mixed $namespace * @param boolean $complete * * @return true * * @codeCoverageIgnore */ function enableSemantics($namespace = null, $complete = false) { global $smwgNamespace; // $GLOBALS ought to be injected from the top-level but that would require // to change the interface which would bring no benefits for the end user // as enableSemantics() is only targeted to be included in LocalSettings NamespaceManager::initCustomNamespace($GLOBALS); if (!$complete && $smwgNamespace !== '') { // The dot tells that the domain is not complete. It will be completed // in the Export since we do not want to create a title object here when // it is not needed in many cases. $smwgNamespace = '.' . $namespace; } else { $smwgNamespace = $namespace; } return true; }
/** * Function to switch on Semantic MediaWiki. This function must be called in * LocalSettings.php after including SMW_Settings.php. It is used to ensure * that required parameters for SMW are really provided explicitly. For * readability, this is the only global function that does not adhere to the * naming conventions. * * This function also sets up all autoloading, such that all SMW classes are * available as early on. Moreover, jobs and special pages are registered. * * @param mixed $namespace * @param boolean $complete * * @return true * * @codeCoverageIgnore */ function enableSemantics($namespace = null, $complete = false) { global $smwgNamespace; // Apparently this is required (1.28+) as the earliest possible execution // point in order for settings that refer to the SMW_NS_PROPERTY namespace // to be available in LocalSettings NamespaceManager::initCustomNamespace($GLOBALS); if (!$complete && $smwgNamespace !== '') { // The dot tells that the domain is not complete. It will be completed // in the Export since we do not want to create a title object here when // it is not needed in many cases. $smwgNamespace = '.' . $namespace; } else { $smwgNamespace = $namespace; } $GLOBALS['smwgSemanticsEnabled'] = true; return true; }