diff --git a/tests/data/README.txt b/tests/data/README.txt index e1832c406..abb8090ad 100644 --- a/tests/data/README.txt +++ b/tests/data/README.txt @@ -1,2 +1,10 @@ Minimal overrides for Hooks::getLocalData() and mw.config required for us to be able to parse HTML generated by the given wiki. + +To make one of these files, run the following in browser console: + +config.json: + JSON.stringify( mw.config.get( [ 'wgContentLanguage', 'wgArticlePath', 'wgNamespaceIds', 'wgFormattedNamespaces' ] ), null, 2 ) + +data.json: + JSON.stringify( mw.loader.moduleRegistry[ 'ext.discussionTools.init' ].packageExports[ 'parser/data.json' ], null, 2 ) diff --git a/tests/data/arwiki-config.json b/tests/data/arwiki-config.json index 0b150f1f7..6d775fd28 100644 --- a/tests/data/arwiki-config.json +++ b/tests/data/arwiki-config.json @@ -1,8 +1,6 @@ { - "wgContentLang": "ar", + "wgContentLanguage": "ar", "wgArticlePath": "/wiki/$1", - "wgMetaNamespace": "ويكيبيديا", - "wgMetaNamespaceTalk": "نقاش_ويكيبيديا", "wgTranslateNumerals": false, "wgNamespaceIds": { "ميديا": -2, diff --git a/tests/data/enwiki-config.json b/tests/data/enwiki-config.json index be057c921..b7fd84495 100644 --- a/tests/data/enwiki-config.json +++ b/tests/data/enwiki-config.json @@ -1,8 +1,6 @@ { - "wgContentLang": "en", + "wgContentLanguage": "en", "wgArticlePath": "/wiki/$1", - "wgMetaNamespace": "Wikipedia", - "wgMetaNamespaceTalk": "Wikipedia_talk", "wgNamespaceIds": { "media": -2, "special": -1, diff --git a/tests/data/frwiki-config.json b/tests/data/frwiki-config.json index 2e7744480..2c3744425 100644 --- a/tests/data/frwiki-config.json +++ b/tests/data/frwiki-config.json @@ -1,8 +1,6 @@ { - "wgContentLang": "fr", + "wgContentLanguage": "fr", "wgArticlePath": "/wiki/$1", - "wgMetaNamespace": "Wikipédia", - "wgMetaNamespaceTalk": "Discussion_Wikipédia", "wgNamespaceIds": { "média": -2, "spécial": -1, diff --git a/tests/data/huwiki-config.json b/tests/data/huwiki-config.json index 5d4b74862..c4fe5aea6 100644 --- a/tests/data/huwiki-config.json +++ b/tests/data/huwiki-config.json @@ -1,8 +1,6 @@ { - "wgContentLang": "hu", + "wgContentLanguage": "hu", "wgArticlePath": "/wiki/$1", - "wgMetaNamespace": "Wikipédia", - "wgMetaNamespaceTalk": "Wikipédia-vita", "wgNamespaceIds": { "média": -2, "speciális": -1, diff --git a/tests/data/nlwiki-config.json b/tests/data/nlwiki-config.json index 1664f1be7..1bfd1a93b 100644 --- a/tests/data/nlwiki-config.json +++ b/tests/data/nlwiki-config.json @@ -1,8 +1,6 @@ { - "wgContentLang": "nl", + "wgContentLanguage": "nl", "wgArticlePath": "/wiki/$1", - "wgMetaNamespace": "Wikipedia", - "wgMetaNamespaceTalk": "Overleg_Wikipedia", "wgNamespaceIds": { "media": -2, "speciaal": -1, diff --git a/tests/data/plwiki-config.json b/tests/data/plwiki-config.json index 7dcfef4a6..03ce266d2 100644 --- a/tests/data/plwiki-config.json +++ b/tests/data/plwiki-config.json @@ -1,8 +1,6 @@ { - "wgContentLang": "pl", + "wgContentLanguage": "pl", "wgArticlePath": "/wiki/$1", - "wgMetaNamespace": "Wikipedia", - "wgMetaNamespaceTalk": "Dyskusja_Wikipedii", "wgNamespaceIds": { "media": -2, "specjalna": -1, diff --git a/tests/phpunit/CommentTestCase.php b/tests/phpunit/CommentTestCase.php index 29b3f237c..78fcc2d8d 100644 --- a/tests/phpunit/CommentTestCase.php +++ b/tests/phpunit/CommentTestCase.php @@ -126,10 +126,12 @@ abstract class CommentTestCase extends MediaWikiTestCase { $this->setMwGlobals( [ 'wgArticlePath' => $config['wgArticlePath'], 'wgNamespaceAliases' => $config['wgNamespaceIds'], + 'wgMetaNamespace' => strtr( $config['wgFormattedNamespaces'][NS_PROJECT], ' ', '_' ), + 'wgMetaNamespaceTalk' => strtr( $config['wgFormattedNamespaces'][NS_PROJECT_TALK], ' ', '_' ), // TODO: Move this to $config 'wgLocaltimezone' => $data['localTimezone'] ] ); - $this->setUserLang( $config['wgContentLang'] ); - $this->setContentLang( $config['wgContentLang'] ); + $this->setUserLang( $config['wgContentLanguage'] ); + $this->setContentLang( $config['wgContentLanguage'] ); } }