Index: trunk/phase3/tests/phpunit/includes/XmlTest.php |
— | — | @@ -13,8 +13,8 @@ |
14 | 14 | // Hardcode namespaces during test runs, |
15 | 15 | // so that html output based on existing namespaces |
16 | 16 | // can be properly evaluated. |
17 | | - self::$oldNamespaces = $wgContLang->namespaceNames; |
18 | | - $wgContLang->namespaceNames = array( |
| 17 | + self::$oldNamespaces = $wgContLang->getNamespaces(); |
| 18 | + $wgContLang->setNamespaces( array( |
19 | 19 | -2 => 'Media', |
20 | 20 | -1 => 'Special', |
21 | 21 | 0 => '', |
— | — | @@ -31,13 +31,14 @@ |
32 | 32 | 11 => 'Template_talk', |
33 | 33 | 100 => 'Custom', |
34 | 34 | 101 => 'Custom_talk', |
35 | | - ); |
| 35 | + ) ); |
36 | 36 | } |
37 | 37 | |
38 | 38 | public function tearDown() { |
39 | 39 | global $wgLang, $wgContLang; |
40 | 40 | $wgLang = self::$oldLang; |
41 | | - $wgContLang->namespaceNames = self::$oldNamespaces; |
| 41 | + |
| 42 | + $wgContLang->setNamespaces( self::$oldNamespaces ); |
42 | 43 | } |
43 | 44 | |
44 | 45 | public function testExpandAttributes() { |
Index: trunk/phase3/tests/phpunit/includes/HtmlTest.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | |
14 | 14 | self::$oldLang = $wgLang; |
15 | 15 | self::$oldContLang = $wgContLang; |
16 | | - self::$oldNamespaces = $wgContLang->namespaceNames; |
| 16 | + self::$oldNamespaces = $wgContLang->getNamespaces(); |
17 | 17 | self::$oldLanguageCode = $wgLanguageCode; |
18 | 18 | |
19 | 19 | $wgLanguageCode = 'en'; |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | // Hardcode namespaces during test runs, |
23 | 23 | // so that html output based on existing namespaces |
24 | 24 | // can be properly evaluated. |
25 | | - $wgContLang->namespaceNames = array( |
| 25 | + $wgContLang->setNamespaces( array( |
26 | 26 | -2 => 'Media', |
27 | 27 | -1 => 'Special', |
28 | 28 | 0 => '', |
— | — | @@ -38,13 +38,13 @@ |
39 | 39 | 11 => 'Template_talk', |
40 | 40 | 100 => 'Custom', |
41 | 41 | 101 => 'Custom_talk', |
42 | | - ); |
| 42 | + ) ); |
43 | 43 | } |
44 | 44 | |
45 | 45 | public function tearDown() { |
46 | 46 | global $wgLang, $wgContLang, $wgLanguageCode; |
47 | 47 | |
48 | | - $wgContLang->namespaceNames = self::$oldNamespaces; |
| 48 | + $wgContLang->setNamespaces( self::$oldNamespaces ); |
49 | 49 | $wgLang = self::$oldLang; |
50 | 50 | $wgContLang = self::$oldContLang; |
51 | 51 | $wgLanguageCode = self::$oldLanguageCode; |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -63,11 +63,10 @@ |
64 | 64 | var $mMagicExtensions = array(), $mMagicHookDone = false; |
65 | 65 | private $mHtmlCode = null; |
66 | 66 | |
67 | | - var $mNamespaceIds, $namespaceAliases; |
68 | 67 | var $dateFormatStrings = array(); |
69 | 68 | var $mExtendedSpecialPageAliases; |
70 | 69 | |
71 | | - public $namespaceNames; |
| 70 | + protected $namespaceNames, $mNamespaceIds, $namespaceAliases; |
72 | 71 | |
73 | 72 | /** |
74 | 73 | * ReplacementArray object caches |
— | — | @@ -331,7 +330,7 @@ |
332 | 331 | /** |
333 | 332 | * @return array |
334 | 333 | */ |
335 | | - function getNamespaces() { |
| 334 | + public function getNamespaces() { |
336 | 335 | if ( is_null( $this->namespaceNames ) ) { |
337 | 336 | global $wgMetaNamespace, $wgMetaNamespaceTalk, $wgExtraNamespaces; |
338 | 337 | |
— | — | @@ -364,6 +363,14 @@ |
365 | 364 | } |
366 | 365 | return $this->namespaceNames; |
367 | 366 | } |
| 367 | + |
| 368 | + /** |
| 369 | + * Arbitrarily set all of the namespace names at once. Mainly used for testing |
| 370 | + * @param $namespaces Array of namespaces (id => name) |
| 371 | + */ |
| 372 | + public function setNamespaces( array $namespaces ) { |
| 373 | + $this->namespaceNames = $namespaces; |
| 374 | + } |
368 | 375 | |
369 | 376 | /** |
370 | 377 | * A convenience function that returns the same thing as |