aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/languages/LanguageBsTest.php
Commit message (Collapse)AuthorAgeFilesLines
* language: fix mw.language.convertGrammar with word-specific casing rulesMáté Szabó2025-03-101-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - mw.language.convertGrammar is responsible for implementing grammatical transformations for inflected languages, similar to its backend counterpart Language::convertGrammar. - The default implementation may be overridden by language-specific implementations loaded dynamically based on the user language. - Both the default implementation and all language-specific implementations suffer from a bug where requesting a case transformation for which word-specific casing rules are defined will return "undefined" if the case transformation was requested for a word for which no word-specific casing rule exists. - There are QUnit tests for the logic, but they only run if the user language matches the language being tested. This means they never run in CI and cannot even be run locally, since Special:JavaScriptTest has been forcing the user language to "qqx" for more than five years. What: - Place language-specific convertGrammar overrides into a new convertGrammarMapping property keyed by language code to allow loading more than one simultaneously. - Introduce and use a new 'mediawiki.language.grammar.testdata' test-only RL module that loads every language-specific convertGrammar override. - Introduce and use a new 'mediawiki.language.testdata' test-only RL module that loads language-specific rules for languages that we have QUnit tests for. Since this only covers less than two dozen languages, there'd be no value in loading this data for all 300+ languages supported by MediaWiki. - Update QUnit tests for convertGrammar to override the user language and language rules before each case. - Ensure word-specific casing rules always take precedence over language-specific convertGrammar implementations to avoid repeated boilerplate in language-specific code. - Don't attempt to use word-specific casing rules for words that do not have one. - As we're here, add matching PHPUnit tests for Language* subclasses that had preexisting QUnit tests but no PHPUnit tests. Bug: T388370 Change-Id: I3f2432f5f801c2a7e4390c2ff2038363a36e2ed9
* Switch over a bunch of class_alias uses to actualsJames D. Forrester2024-10-031-2/+2
| | | | Change-Id: Id175a83e71cc910eaee5d5890a9106872a3ca3b8
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-3/+3
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* Move Language subclasses to includes/Timo Tijhof2021-08-041-0/+47
Depending on which namespace we want these classes to have after T166010 they could either stay in includes/languages/ (plural) in their own MediaWiki\Languages\-namespace dedicated to Language subclasses, or they could go in into a subdirectory like `includes/language/languages/` if we want to keep them in the same top-level namespace as other Language classes and services, but in a more nested namespace. For now, I've made the smaller change and kept the Language subclasses in their own directory directly under includes/, not nested further. Bug: T225756 Change-Id: I01015424707b442853879fd50c97f00215e5c2fa