Use setContentLang() instead of setMwGlobals()
[lhc/web/wiklou.git] / tests / phpunit / includes / EditPageTest.php
index ad0d07a..036b618 100644 (file)
@@ -16,11 +16,12 @@ class EditPageTest extends MediaWikiLangTestCase {
 
                parent::setUp();
 
+               $this->setContentLang( $wgContLang );
+
                $this->setMwGlobals( [
                        'wgExtraNamespaces' => $wgExtraNamespaces,
                        'wgNamespaceContentModels' => $wgNamespaceContentModels,
                        'wgContentHandlers' => $wgContentHandlers,
-                       'wgContLang' => $wgContLang,
                ] );
 
                $wgExtraNamespaces[12312] = 'Dummy';
@@ -29,8 +30,16 @@ class EditPageTest extends MediaWikiLangTestCase {
                $wgNamespaceContentModels[12312] = "testing";
                $wgContentHandlers["testing"] = 'DummyContentHandlerForTesting';
 
-               MWNamespace::getCanonicalNamespaces( true ); # reset namespace cache
+               MWNamespace::clearCaches();
+               $wgContLang->resetNamespaces(); # reset namespace cache
+       }
+
+       protected function tearDown() {
+               global $wgContLang;
+
+               MWNamespace::clearCaches();
                $wgContLang->resetNamespaces(); # reset namespace cache
+               parent::tearDown();
        }
 
        /**
@@ -709,7 +718,7 @@ hello
                $ep->importFormData( $req );
 
                $this->setExpectedException(
-                       'MWException',
+                       MWException::class,
                        'This content model is not supported: testing'
                );