Commit graph

13 commits

Author SHA1 Message Date
jenkins-bot
690f563edc Merge "Accept BCP 47 codes as aliases for nonstandard variants" 2018-10-11 20:46:42 +00:00
C. Scott Ananian
d59f27aeab Accept BCP 47 codes as aliases for nonstandard variants
The browser Accept-Language header uses BCP 47 codes, which don't
precisely match our internal mediawiki variant names in a number of
places.  Allow proper BCP 47 codes to alias our internal variants
for: Accept-Language parsing, URL parsing, user preferences, and
explicit enumeration of codes in LanguageConverter rules.

This is a replay of an earlier merged patch,
0818070c59, which had to be reverted
because it was based on 8380f0173e which
caused regressions in the Babel extension (T199941).

Change-Id: Ica89d9547c58967747ab0fa15d4e83be5378796d
2018-10-11 02:23:20 -04:00
Kunal Mehta
a4e8bea57d tests: Add helper function for ini_set with automatic cleanup
Some tests need to change the value of an ini setting, and typically implement
cleanup handling themselves, usually imperfectly.

Provide a helper function, $this->setIniSetting(), which will take care of
teardown in the same way that $this->setMwGlobals() does.

Change-Id: I7be4198592f0aaf73a28d3c60acb307a918b1a1f
2018-10-10 22:31:37 -07:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Aryeh Gregor
355e21590a Use setContentLang() instead of setMwGlobals()
This changes behavior in some tests by making them set $wgLanguageCode
as well as $wgContLang, but that seems like a good thing.

Bug: T200246
Change-Id: I936888f46ff9fefe2707efba837e2ce3a7ca5e3f
2018-07-26 11:35:58 +00:00
Greg Grossmeier
dc282a46d7 Revert "Accept BCP 47 codes as aliases for nonstandard variants"
This reverts commit 0818070c59.

Reason for revert: Caused T199941

Bug: T199941
Change-Id: I24c178eb33890477de79cbb3122861c140578011
2018-07-23 16:44:55 +00:00
C. Scott Ananian
0818070c59 Accept BCP 47 codes as aliases for nonstandard variants
The browser Accept-Language header uses BCP 47 codes, which don't
precisely match our internal mediawiki variant names in a number of
places.  Allow proper BCP 47 codes to alias our internal variants
for: Accept-Language parsing, URL parsing, user preferences, and
explicit enumeration of codes in LanguageConverter rules.

Change-Id: I8468a56d5b88f5786abd0a17b67bda2f1687fd0c
2018-07-13 17:43:20 -04:00
Kunal Mehta
fc23633035 Add @covers tags to languages tests
I removed comments that merely repeated the location of the class being
tested. There are other tests in this directory that don't have a
corresponding class and need further investigation.

Change-Id: Ic16f0887b5030ac53fab4382cfaedfb5426cdb08
2017-12-28 08:52:56 +00:00
Reedy
f600b4ede9 Fix phpcs issues from LanguageConverter patches
Change-Id: I34e57c90ffd40fbd9f8afe3c57dd73fa7f655841
2017-11-15 03:37:27 +00:00
Brian Wolff
fbe78cfa09 SECURITY: XSS in langconverter when regex hits pcre.backtrack_limit
Adjust regexes for what not to convert to avoid backtracking by
preferring possesive quantifiers

Add check that we really have matched to the end of the string, and
log error if the regex hits some sort of error preventing the
entire string from being matched. Should the regex not match to the
end, then language conversion is disabled for the string.

Bug: T124404
Change-Id: I4f0c171c7da804e9c1508ef1f59556665a318f6a
2017-11-15 03:33:03 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Timo Tijhof
3b35719e74 tests: Remove unused $wgMemc resets
If we really need this we can do it in MediaWikiTestCase, next
to the setting of wgMainCacheType. But from what I can see the
code being tested here already doesn't use the old $wgMemc.

Change-Id: I9e4b2109b2f3c18d8d5551bbadae5711c1d4c0a6
2015-12-06 18:06:08 +00:00
umherirrender
0d39b3bb0d Move Test files under same folder structure where class is (/languages/)
Change-Id: I25c99272a1c2e318e6c61b4a497bf04886430e9b
2015-01-10 19:53:59 +00:00
Renamed from tests/phpunit/includes/LanguageConverterTest.php (Browse further)