Since we're here: nothing uses $namespaceNames, $mNamespaceIds or $namespaceAliases
outside of this class (core or extensions) so lets make it protected.
var $mMagicExtensions = array(), $mMagicHookDone = false;
private $mHtmlCode = null;
- var $mNamespaceIds, $namespaceAliases;
var $dateFormatStrings = array();
var $mExtendedSpecialPageAliases;
- public $namespaceNames;
+ protected $namespaceNames, $mNamespaceIds, $namespaceAliases;
/**
* ReplacementArray object caches
/**
* @return array
*/
- function getNamespaces() {
+ public function getNamespaces() {
if ( is_null( $this->namespaceNames ) ) {
global $wgMetaNamespace, $wgMetaNamespaceTalk, $wgExtraNamespaces;
}
return $this->namespaceNames;
}
+
+ /**
+ * Arbitrarily set all of the namespace names at once. Mainly used for testing
+ * @param $namespaces Array of namespaces (id => name)
+ */
+ public function setNamespaces( array $namespaces ) {
+ $this->namespaceNames = $namespaces;
+ }
/**
* A convenience function that returns the same thing as
self::$oldLang = $wgLang;
self::$oldContLang = $wgContLang;
- self::$oldNamespaces = $wgContLang->namespaceNames;
+ self::$oldNamespaces = $wgContLang->getNamespaces();
self::$oldLanguageCode = $wgLanguageCode;
$wgLanguageCode = 'en';
// Hardcode namespaces during test runs,
// so that html output based on existing namespaces
// can be properly evaluated.
- $wgContLang->namespaceNames = array(
+ $wgContLang->setNamespaces( array(
-2 => 'Media',
-1 => 'Special',
0 => '',
11 => 'Template_talk',
100 => 'Custom',
101 => 'Custom_talk',
- );
+ ) );
}
public function tearDown() {
global $wgLang, $wgContLang, $wgLanguageCode;
- $wgContLang->namespaceNames = self::$oldNamespaces;
+ $wgContLang->setNamespaces( self::$oldNamespaces );
$wgLang = self::$oldLang;
$wgContLang = self::$oldContLang;
$wgLanguageCode = self::$oldLanguageCode;
// Hardcode namespaces during test runs,
// so that html output based on existing namespaces
// can be properly evaluated.
- self::$oldNamespaces = $wgContLang->namespaceNames;
- $wgContLang->namespaceNames = array(
+ self::$oldNamespaces = $wgContLang->getNamespaces();
+ $wgContLang->setNamespaces( array(
-2 => 'Media',
-1 => 'Special',
0 => '',
11 => 'Template_talk',
100 => 'Custom',
101 => 'Custom_talk',
- );
+ ) );
}
public function tearDown() {
global $wgLang, $wgContLang;
$wgLang = self::$oldLang;
- $wgContLang->namespaceNames = self::$oldNamespaces;
+
+ $wgContLang->setNamespaces( self::$oldNamespaces );
}
public function testExpandAttributes() {