diff options
author | daniel <dkinzler@wikimedia.org> | 2025-01-28 17:41:26 +0100 |
---|---|---|
committer | daniel <dkinzler@wikimedia.org> | 2025-01-28 22:07:44 +0100 |
commit | f4a2e94f4d989ad05ef65d6efc74cb392689f553 (patch) | |
tree | b36310a1c7fb9bb9bf916f0b88add98e583b722a /includes/DevelopmentSettings.php | |
parent | 05a191d0244d1a1e6346472217a1dfc1d445609b (diff) | |
download | mediawikicore-f4a2e94f4d989ad05ef65d6efc74cb392689f553.tar.gz mediawikicore-f4a2e94f4d989ad05ef65d6efc74cb392689f553.zip |
Mocha tests: Support language links to en-x-piglatin
Why:
- In order to test functionality related to interwiki links, we need to
define an interwiki prefix that matches a language code, and make it
available in all test environments.
- This way, links of the form [[en-x-piglatin:...]] will be interpreted
as "magic" language links.
What:
- Add a hook handler for InterwikiLoadPrefix to DevelopmentSettings.php
to provide a URL for the 'en-x-piglatin' prefix.
Bug: T382458
Change-Id: I908dca770ef0d88f70af09afbaa267aa92750ba1
Diffstat (limited to 'includes/DevelopmentSettings.php')
-rw-r--r-- | includes/DevelopmentSettings.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/includes/DevelopmentSettings.php b/includes/DevelopmentSettings.php index 489886dd9ec5..20561ed31fe4 100644 --- a/includes/DevelopmentSettings.php +++ b/includes/DevelopmentSettings.php @@ -187,3 +187,13 @@ $wgDefaultUserOptions['visualeditor-newwikitext'] = 0; // Enable creation of temp user accounts on edit (T355880, T359043) $wgAutoCreateTempUser['enabled'] = true; + +// Make sure Mocha tests can create language links by defining an interwiki +// prefix that matches a known language code. +$wgHooks['InterwikiLoadPrefix'][] = static function ( $prefix, &$iwData ) { + if ( $prefix === 'en-x-piglatin' ) { + $iwData['iw_url'] = 'https://piggy.wikipedia.org/wiki/$1'; + return false; + } + return true; +}; |