These are not configuration but business logic, similar to the canonical names that are in NamespaceInfo.php, these must always exist and cannot be altered or unset. They were previously unconditionally assigned during all requests in Setup.php and passed down as "site configuration". Changes: * Move them to MessagesEn.php where they can be cached and processed the same way as other core-provided aliases. Document and confirm with tests that this is a mergeable attribute that follows the language chain. * Remove the duplicated code in a few places that was reading this variable + Language::getNamespaceAliases(), to instead just call the latter and move the logic there, centralised, and tested. In doing so I noticed that these were applied in an inconsistent order. Sometimes the config won, sometimes not. There's no obvious right or wrong way here, but I've chosen to standardise on the way that Language::getNamespaceIds() did it, which is that config wins. This because that method seems to be most widely used of the three (it decides how URLs and titles are parsed), and thus the one I least want to change the behaviour of. * Document that $wgNamespaceAliases may only be used to define (extra) aliases, it is and never was a way to access the complete list of aliases. Bug: T189966 Change-Id: Ibb14181aba8c1b509264ed40523e9ab4000fd71a |
||
|---|---|---|
| .. | ||
| data | ||
| docs | ||
| documentation | ||
| includes | ||
| integration/includes | ||
| languages | ||
| maintenance | ||
| mocks | ||
| skins | ||
| structure | ||
| suites | ||
| tests | ||
| unit | ||
| bootstrap.maintenance.php | ||
| bootstrap.php | ||
| HamcrestPHPUnitIntegration.php | ||
| LessFileCompilationTest.php | ||
| Makefile | ||
| MediaWikiCliOptions.php | ||
| MediaWikiCoversValidator.php | ||
| MediaWikiGroupValidator.php | ||
| MediaWikiIntegrationTestCase.php | ||
| MediaWikiLangTestCase.php | ||
| MediaWikiLoggerPHPUnitTestListener.php | ||
| MediaWikiPHPUnitCommand.php | ||
| MediaWikiPHPUnitResultPrinter.php | ||
| MediaWikiPHPUnitTestListener.php | ||
| MediaWikiTestCaseTrait.php | ||
| MediaWikiUnitTestCase.php | ||
| phpunit.php | ||
| PHPUnit4And6Compat.php | ||
| PHPUnit6And8Compat.php | ||
| README | ||
| ResourceLoaderTestCase.php | ||
| run-tests.bat | ||
| suite.xml | ||
== MediaWiki PHPUnit Tests == The unit and integration tests for MediaWiki are implemented using the PHPUnit testing framework and require PHPUnit to run. === WARNING === Some of the integration tests are DESTRUCTIVE and WILL ALTER YOUR WIKI'S CONTENTS. DO NOT RUN THESE TESTS ON A PRODUCTION SYSTEM OR ON ANY SYSTEM WHERE YOU NEED TO RETAIN YOUR DATA. == Installation == If you used composer to install MediaWiki's dependencies PHPUnit will already be available, unless you explicitly specified the --no-dev flag during the install. In this case just run "composer update". Otherwise follow the installation instructions in the PHPUnit Manual at: https://phpunit.de/manual/current/en/installation.html == Running tests == The tests are run from your operating system's command line. Ensure that you are in the tests/phpunit directory of your MediaWiki installation. On Unix-like operating systems, the tests runs are controlled with a makefile. Run command: make help for a full list of options for running tests. On Windows-family operating systems, run the 'run-tests.bat' batch file. === Writing tests === A guide to writing PHP unit tests for MediaWiki can be found at: https://www.mediawiki.org/wiki/Manual:PHP_unit_testing