diff options
author | daniel <dkinzler@wikimedia.org> | 2021-05-07 15:53:09 +0200 |
---|---|---|
committer | daniel <dkinzler@wikimedia.org> | 2021-05-07 16:10:48 +0200 |
commit | c22695e5e747f7fd560751bee53a3e1335b43139 (patch) | |
tree | 668e93da7a859ed93fe79da056cdf2b0edfc435f /includes | |
parent | cd8d97368f3d8dbba978cb2a3584c90dcceeee0a (diff) | |
download | mediawikicore-c22695e5e747f7fd560751bee53a3e1335b43139.tar.gz mediawikicore-c22695e5e747f7fd560751bee53a3e1335b43139.zip |
Declare $wgCanonicalNamespaceNames in DefaultSettings.php
This ensures tests can run from phpstorm directly, without MediaWiki's
custom phpunit wrapper.
Background:
$wgCanonicalNamespaceNames needs to be declared in DefaultSettings so
it works properly when Setup.php is included via
wfRequireOnceInGlobalScope, as is the case in
MediaWikiIntegrationTestCase::initializeForStandardPhpunitEntrypointIfNeeded.
wfRequireOnceInGlobalScope will import any variables in the global scope
into the local scope to make them available in the included file. It
also exports all variables declared in the scope of the included file to
the global scope, but only after the file includsion returns.
If $wgCanonicalNamespaceNames is not defined in global scope before
Setup.php runs, then the $wgCanonicalNamespaceNames variable defined in
Setup.php will not become global until after Setup.php finishes.
However, Setup.php instantiates services that need
$wgCanonicalNamespaceNames to be present. This causes the test framework
to fail.
Change-Id: I8c5179433737170303f37cb072cb0352006ca173
Diffstat (limited to 'includes')
-rw-r--r-- | includes/DefaultSettings.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 5cd7d04a429a..4fb92d905026 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4516,6 +4516,13 @@ $wgMetaNamespace = false; $wgMetaNamespaceTalk = false; /** + * Canonical namespace names. + * + * Must not be changed directly in configuration or by extensions, use $wgExtraNamespaces instead. + */ +$wgCanonicalNamespaceNames = NamespaceInfo::CANONICAL_NAMES; + +/** * Additional namespaces. If the namespaces defined in Language.php and * Namespace.php are insufficient, you can create new ones here, for example, * to import Help files in other languages. You can also override the namespace |