10 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
11 $this->
getLang()->normalizeForSearch(
12 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
14 'convertDoubleWidth() with the full alphabet and digits'
23 $this->assertEquals( $expected, $this->
getLang()->formatTimePeriod( $seconds, $format ), $desc );
32 'formatTimePeriod() rounding (<10s)'
36 [
'noabbrevs' =>
true ],
38 'formatTimePeriod() rounding (<10s)'
44 'formatTimePeriod() rounding (<10s)'
48 [
'noabbrevs' =>
true ],
50 'formatTimePeriod() rounding (<10s)'
56 'formatTimePeriod() rounding (<60s)'
60 [
'noabbrevs' =>
true ],
62 'formatTimePeriod() rounding (<60s)'
68 'formatTimePeriod() rounding (<1h)'
72 [
'noabbrevs' =>
true ],
73 '2 minutes 0 seconds',
74 'formatTimePeriod() rounding (<1h)'
80 'formatTimePeriod() rounding (<1h)'
84 [
'noabbrevs' =>
true ],
85 '1 hour 0 minutes 0 seconds',
86 'formatTimePeriod() rounding (<1h)'
92 'formatTimePeriod() rounding (>=1h)'
96 [
'noabbrevs' =>
true ],
97 '2 hours 0 minutes 0 seconds',
98 'formatTimePeriod() rounding (>=1h)'
104 'formatTimePeriod() rounding (>=1h), avoidseconds'
108 [
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ],
110 'formatTimePeriod() rounding (>=1h), avoidseconds'
116 'formatTimePeriod() rounding (>=1h), avoidminutes'
120 [
'avoid' =>
'avoidminutes',
'noabbrevs' =>
true ],
122 'formatTimePeriod() rounding (>=1h), avoidminutes'
128 'formatTimePeriod() rounding (=48h), avoidseconds'
132 [
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ],
133 '48 hours 0 minutes',
134 'formatTimePeriod() rounding (=48h), avoidseconds'
140 'formatTimePeriod() rounding (>48h), avoidminutes'
144 [
'avoid' =>
'avoidminutes',
'noabbrevs' =>
true ],
146 'formatTimePeriod() rounding (>48h), avoidminutes'
152 'formatTimePeriod() rounding (>48h), avoidseconds'
156 [
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ],
157 '2 days 1 hour 0 minutes',
158 'formatTimePeriod() rounding (>48h), avoidseconds'
164 'formatTimePeriod() rounding (>48h), avoidminutes'
168 [
'avoid' =>
'avoidminutes',
'noabbrevs' =>
true ],
170 'formatTimePeriod() rounding (>48h), avoidminutes'
176 'formatTimePeriod() rounding (>48h), avoidseconds'
180 [
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ],
181 '3 days 0 hours 0 minutes',
182 'formatTimePeriod() rounding (>48h), avoidseconds'
188 'formatTimePeriod() rounding, (>48h), avoidseconds'
192 [
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ],
193 '2 days 0 hours 0 minutes',
194 'formatTimePeriod() rounding, (>48h), avoidseconds'
200 'formatTimePeriod() rounding, recursion, (>48h)'
204 [
'noabbrevs' =>
true ],
205 '2 days 1 hour 1 minute 1 second',
206 'formatTimePeriod() rounding, recursion, (>48h)'
217 $this->
getLang()->truncate(
"1234567890", 0,
'XXX' ),
218 'truncate prefix, len 0, small ellipsis'
223 $this->
getLang()->truncate(
"1234567890", 8,
'XXX' ),
224 'truncate prefix, small ellipsis'
229 $this->
getLang()->truncate(
"123456789", 5,
'XXXXXXXXXXXXXXX' ),
230 'truncate prefix, large ellipsis'
235 $this->
getLang()->truncate(
"1234567890", -8,
'XXX' ),
236 'truncate suffix, small ellipsis'
241 $this->
getLang()->truncate(
"123456789", -5,
'XXXXXXXXXXXXXXX' ),
242 'truncate suffix, large ellipsis'
246 $this->
getLang()->truncate(
"123 ", 9,
'XXX' ),
247 'truncate prefix, with spaces'
251 $this->
getLang()->truncate(
"12345 8", 11,
'XXX' ),
252 'truncate prefix, with spaces and non-space ending'
256 $this->
getLang()->truncate(
"1 234", -8,
'XXX' ),
257 'truncate suffix, with spaces'
261 $this->
getLang()->truncate(
"1234567890", 5,
'XXX',
false ),
262 'truncate without adjustment'
266 $this->
getLang()->truncate(
"泰乐菌素123456789", 11,
'...',
false ),
267 'truncate does not chop Unicode characters in half'
271 $this->
getLang()->truncate(
"\n泰乐菌素123456789", 12,
'...',
false ),
272 'truncate does not chop Unicode characters in half if there is a preceding newline'
284 $this->
getLang()->truncateHtml( $input, $len, $ellipsis )
293 [ 0,
'XXX',
"1234567890",
"XXX" ],
294 [ 8,
'XXX',
"1234567890",
"12345XXX" ],
295 [ 5,
'XXXXXXXXXXXXXXX',
'1234567890',
"1234567890" ],
297 '<p><span style="font-weight:bold;"></span></p>',
298 '<p><span style="font-weight:bold;"></span></p>',
301 '<p><span style="font-weight:bold;">123456789</span></p>',
302 '<p><span style="font-weight:bold;">***</span></p>',
305 '<p><span style="font-weight:bold;"> 23456789</span></p>',
306 '<p><span style="font-weight:bold;">***</span></p>',
309 '<p><span style="font-weight:bold;">123456789</span></p>',
310 '<p><span style="font-weight:bold;">***</span></p>',
313 '<p><span style="font-weight:bold;">123456789</span></p>',
314 '<p><span style="font-weight:bold;">1***</span></p>',
317 '<tt><span style="font-weight:bold;">123456789</span></tt>',
318 '<tt><span style="font-weight:bold;">12***</span></tt>',
321 '<p><a href="www.mediawiki.org">123456789</a></p>',
322 '<p><a href="www.mediawiki.org">123***</a></p>',
325 '<p><a href="www.mediawiki.org">12 456789</a></p>',
326 '<p><a href="www.mediawiki.org">12 ***</a></p>',
329 '<small><span style="font-weight:bold;">123<p id="#moo">456</p>789</span></small>',
330 '<small><span style="font-weight:bold;">123<p id="#moo">4***</p></span></small>',
333 '<div><span style="font-weight:bold;">123<span>4</span>56789</span></div>',
334 '<div><span style="font-weight:bold;">123<span>4</span>5***</span></div>',
337 '<p><table style="font-weight:bold;"><tr><td>123456789</td></tr></table></p>',
338 '<p><table style="font-weight:bold;"><tr><td>123456789</td></tr></table></p>',
341 '<p><font style="font-weight:bold;">123456789</font></p>',
342 '<p><font style="font-weight:bold;">123456789</font></p>',
355 "validating code $code $message"
367 [
'fr',
'two-letter code' ],
368 [
'fr-latn',
'two-letter code with lower case script code' ],
369 [
'fr-Latn-FR',
'two-letter code with title case script code and uppercase country code' ],
370 [
'fr-Latn-419',
'two-letter code with title case script code and region number' ],
371 [
'fr-FR',
'two-letter code with uppercase' ],
372 [
'ax-TZ',
'Not in the registry, but well-formed' ],
373 [
'fr-shadok',
'two-letter code with variant' ],
374 [
'fr-y-myext-myext2',
'non-x singleton' ],
375 [
'fra-Latn',
'ISO 639 can be 3-letters' ],
376 [
'fra',
'three-letter language code' ],
377 [
'fra-FX',
'three-letter language code with country code' ],
378 [
'i-klingon',
'grandfathered with singleton' ],
379 [
'I-kLINgon',
'tags are case-insensitive...' ],
380 [
'no-bok',
'grandfathered without singleton' ],
381 [
'i-enochian',
'Grandfathered' ],
382 [
'x-fr-CH',
'private use' ],
383 [
'es-419',
'two-letter code with region number' ],
384 [
'en-Latn-GB-boont-r-extended-sequence-x-private',
'weird, but well-formed' ],
385 [
'ab-x-abc-x-abc',
'anything goes after x' ],
386 [
'ab-x-abc-a-a',
'anything goes after x, including several non-x singletons' ],
387 [
'i-default',
'grandfathered' ],
388 [
'abcd-Latn',
'Language of 4 chars reserved for future use' ],
389 [
'AaBbCcDd-x-y-any-x',
'Language of 5-8 chars, registered' ],
390 [
'de-CH-1901',
'with country and year' ],
391 [
'en-US-x-twain',
'with country and singleton' ],
392 [
'zh-cmn',
'three-letter variant' ],
393 [
'zh-cmn-Hant',
'three-letter variant and script' ],
394 [
'zh-cmn-Hant-HK',
'three-letter variant, script and country' ],
395 [
'xr-p-lze',
'Extension' ],
407 "validating that code $code is a malformed language tag - $message"
419 [
'f',
'language too short' ],
420 [
'f-Latn',
'language too short with script' ],
421 [
'xr-lxs-qut',
'variants too short' ], # extlangS
422 [
'fr-Latn-F',
'region too short' ],
423 [
'a-value',
'language too short with region' ],
424 [
'tlh-a-b-foo',
'valid three-letter with wrong variant' ],
427 'grandfathered but not registered: invalid, even if we only test well-formedness'
429 [
'abcdefghi-012345678',
'numbers too long' ],
430 [
'ab-abc-abc-abc-abc',
'invalid extensions' ],
431 [
'ab-abcd-abc',
'invalid extensions' ],
432 [
'ab-ab-abc',
'invalid extensions' ],
433 [
'ab-123-abc',
'invalid extensions' ],
434 [
'a-Hant-ZH',
'short language with valid extensions' ],
435 [
'a1-Hant-ZH',
'invalid character in language' ],
436 [
'ab-abcde-abc',
'invalid extensions' ],
437 [
'ab-1abc-abc',
'invalid characters in extensions' ],
438 [
'ab-ab-abcd',
'invalid order of extensions' ],
439 [
'ab-123-abcd',
'invalid order of extensions' ],
440 [
'ab-abcde-abcd',
'invalid extensions' ],
441 [
'ab-1abc-abcd',
'invalid characters in extensions' ],
442 [
'ab-a-b',
'extensions too short' ],
443 [
'ab-a-x',
'extensions too short, even with singleton' ],
444 [
'ab--ab',
'two separators' ],
445 [
'ab-abc-',
'separator in the end' ],
446 [
'-ab-abc',
'separator in the beginning' ],
447 [
'abcd-efg',
'language too long' ],
448 [
'aabbccddE',
'tag too long' ],
449 [
'pa_guru',
'A tag with underscore is invalid in strict mode' ],
450 [
'de-f',
'subtag too short' ],
461 'pa_guru is a well-formed language tag in lenient mode'
471 $this->assertEquals( $expected,
473 "validating code $code $message"
479 [
'fr',
true,
'Two letters, minor case' ],
480 [
'EN',
false,
'Two letters, upper case' ],
481 [
'tyv',
true,
'Three letters' ],
482 [
'tokipona',
true,
'long language code' ],
483 [
'be-tarask',
true,
'With dash' ],
484 [
'be-x-old',
true,
'With extension (two dashes)' ],
485 [
'be_tarask',
false,
'Reject underscores' ],
497 "validating code $code - $message"
503 [
'fr',
'simple code' ],
504 [
'bat-smg',
'an MW legacy tag' ],
505 [
'sgs',
'an internal standard MW name, for which a legacy tag is used externally' ],
513 if ( !class_exists(
'LanguageNames' ) ) {
514 $this->markTestSkipped(
'The LanguageNames class is not available. '
515 .
'The CLDR extension is probably not installed.' );
520 'validating code "pal" an ancient language, which probably will '
521 .
'not appear in Names.php, but appears in CLDR in English'
533 "checking that code $code is invalid - $message"
539 [
'mw',
'non-existent two-letter code' ],
540 [
'foo"<bar',
'very invalid language code' ],
550 $this->
getLang()->sprintfDate(
'xiY',
'1234567890123' );
559 $this->
getLang()->sprintfDate(
'xiY',
'123456789012345' );
568 $this->
getLang()->sprintfDate(
'xiY',
'-1234567890123' );
579 $this->
getLang()->sprintfDate( $format, $ts, null, $ttl ),
580 "sprintfDate('$format', '$ts'): $msg"
583 $dt =
new DateTime( $ts );
584 $lastValidTS = $dt->add(
new DateInterval(
'PT' . ( $ttl - 1 ) .
'S' ) )->format(
'YmdHis' );
587 $this->
getLang()->sprintfDate( $format, $lastValidTS, null ),
588 "sprintfDate('$format', '$ts'): TTL $ttl too high (output was different at $lastValidTS)"
592 $dt =
new DateTime( $ts );
593 $newTS = $dt->add(
new DateInterval(
'P1Y1M8DT13H1M1S' ) )->format(
'YmdHis' );
596 $this->
getLang()->sprintfDate( $format, $newTS, null ),
597 "sprintfDate('$format', '$ts'): Missing TTL (output was different at $newTS)"
608 $oldTZ = date_default_timezone_get();
609 $res = date_default_timezone_set(
'Asia/Seoul' );
611 $this->markTestSkipped(
"Error setting Timezone" );
616 $this->
getLang()->sprintfDate( $format, $ts ),
617 "sprintfDate('$format', '$ts'): $msg"
620 date_default_timezone_set( $oldTZ );
631 $this->markTestSkipped(
"Error getting Timezone" );
636 $this->
getLang()->sprintfDate( $format, $ts, $tz ),
637 "sprintfDate('$format', '$ts', 'Asia/Seoul'): $msg"
648 'Iranian calendar full year'
655 'Iranian calendar short year'
662 'ISO 8601 (week) year'
713 'Month index, not zero pad'
720 'Month index. Zero pad'
741 'Genitive month name (same in EN)'
748 'Day of month (not zero pad)'
755 'Day of month (zero-pad)'
762 'Day of year (zero-indexed)'
769 'Day of week (abbrev)'
783 'Day of week (Mon=1, Sun=7)'
790 'Day of week (Sun=0, Sat=6)'
832 '12 hour, zero padded'
881 'Days in current month'
886 '2012-01-02T09:07:05+00:00',
887 '2012-01-02T09:07:05+09:00',
893 'Mon, 02 Jan 2012 09:07:05 +0000',
894 'Mon, 02 Jan 2012 09:07:05 +0900',
902 'Timezone identifier'
923 'Timezone offset with colon'
930 'Timezone abbreviation'
937 'Timezone offset in seconds'
965 'Hebrew number of days in month'
972 'Hebrew genitive month name (No difference in EN)'
1014 'Raw numerals (doesn\'t mean much in EN)'
1017 '[[Y "(yea"\\r)]] \\"xx\\"',
1019 '[[2012 (year)]] "x"',
1020 '[[2012 (year)]] "x"',
1032 $this->assertEquals(
1034 $this->
getLang()->formatSize( $size ),
1035 "formatSize('$size'): $msg"
1095 $this->assertEquals(
1097 $this->
getLang()->formatBitrate( $bps ),
1098 "formatBitrate('$bps'): $msg"
1112 "999 bits per second"
1117 "1 kilobit per second"
1122 "1 megabit per second"
1127 "1 gigabit per second"
1132 "1 terabit per second"
1137 "1 petabit per second"
1142 "1 exabit per second"
1147 "1 zetabit per second"
1152 "1 yottabit per second"
1157 "1,000 yottabits per second"
1167 $this->assertEquals(
1169 $this->
getLang()->formatDuration( $duration, $intervals ),
1170 "formatDuration('$duration'): $expected"
1214 ( 365 + ( 24 * 3 + 25 ) / 400.0 ) * 86400,
1247 '2 hours, 30 minutes and 1 second'
1251 '1 hour and 1 second'
1254 31556952 + 2 * 86400 + 9000,
1255 '1 year, 2 days, 2 hours and 30 minutes'
1258 42 * 1000 * 31556952 + 42,
1259 '42 millennia and 42 seconds'
1277 31556952 + 2 * 86400 + 9000,
1278 '1 year, 2 days and 150 minutes',
1279 [
'years',
'days',
'minutes' ],
1284 [
'years',
'days' ],
1287 31556952 + 2 * 86400 + 9000,
1288 '1 year, 2 days and 150 minutes',
1289 [
'minutes',
'days',
'years' ],
1294 [
'days',
'years' ],
1304 $this->assertEquals(
1306 $this->
getLang()->checkTitleEncoding(
$s ),
1307 "checkTitleEncoding('$s')"
1315 [
"United States of America" ],
1316 [ rawurldecode(
"S%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e" ) ],
1319 "Acteur%7CAlbert%20Robbins%7CAnglais%7CAnn%20Donahue%7CAnthony%20E.%20Zuiker%7CCarol%20Mendelsohn"
1327 "Acteur%7CAlbert%20Robbins%7CAnglais%7CAnn%20Donahue%7CAnthony%20E.%20Zuiker%7CCarol%20Mendelsohn%7C"
1328 .
"Catherine%20Willows%7CDavid%20Hodges%7CDavid%20Phillips%7CGil%20Grissom%7CGreg%20Sanders%7CHodges%7C"
1329 .
"Internet%20Movie%20Database%7CJim%20Brass%7CLady%20Heather%7C"
1330 .
"Les%20Experts%20(s%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e)%7CLes%20Experts%20:%20Manhattan%7C"
1331 .
"Les%20Experts%20:%20Miami%7CListe%20des%20personnages%20des%20Experts%7C"
1332 .
"Liste%20des%20%C3%A9pisodes%20des%20Experts%7CMod%C3%A8le%20discussion:Palette%20Les%20Experts%7C"
1333 .
"Nick%20Stokes%7CPersonnage%20de%20fiction%7CPersonnage%20fictif%7CPersonnage%20de%20fiction%7C"
1334 .
"Personnages%20r%C3%A9currents%20dans%20Les%20Experts%7CRaymond%20Langston%7CRiley%20Adams%7C"
1335 .
"Saison%201%20des%20Experts%7CSaison%2010%20des%20Experts%7CSaison%2011%20des%20Experts%7C"
1336 .
"Saison%2012%20des%20Experts%7CSaison%202%20des%20Experts%7CSaison%203%20des%20Experts%7C"
1337 .
"Saison%204%20des%20Experts%7CSaison%205%20des%20Experts%7CSaison%206%20des%20Experts%7C"
1338 .
"Saison%207%20des%20Experts%7CSaison%208%20des%20Experts%7CSaison%209%20des%20Experts%7C"
1339 .
"Sara%20Sidle%7CSofia%20Curtis%7CS%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e%7CWallace%20Langham%7C"
1340 .
"Warrick%20Brown%7CWendy%20Simms%7C%C3%89tats-Unis"
1345 "Mod%C3%A8le%3AArrondissements%20homonymes%7CMod%C3%A8le%3ABandeau%20standard%20pour%20page%20d'homonymie%7C"
1346 .
"Mod%C3%A8le%3ABatailles%20homonymes%7CMod%C3%A8le%3ACantons%20homonymes%7C"
1347 .
"Mod%C3%A8le%3ACommunes%20fran%C3%A7aises%20homonymes%7CMod%C3%A8le%3AFilms%20homonymes%7C"
1348 .
"Mod%C3%A8le%3AGouvernements%20homonymes%7CMod%C3%A8le%3AGuerres%20homonymes%7CMod%C3%A8le%3AHomonymie%7C"
1349 .
"Mod%C3%A8le%3AHomonymie%20bateau%7CMod%C3%A8le%3AHomonymie%20d'%C3%A9tablissements%20scolaires%20ou"
1350 .
"%20universitaires%7CMod%C3%A8le%3AHomonymie%20d'%C3%AEles%7CMod%C3%A8le%3AHomonymie%20de%20clubs%20sportifs%7C"
1351 .
"Mod%C3%A8le%3AHomonymie%20de%20comt%C3%A9s%7CMod%C3%A8le%3AHomonymie%20de%20monument%7C"
1352 .
"Mod%C3%A8le%3AHomonymie%20de%20nom%20romain%7CMod%C3%A8le%3AHomonymie%20de%20parti%20politique%7C"
1353 .
"Mod%C3%A8le%3AHomonymie%20de%20route%7CMod%C3%A8le%3AHomonymie%20dynastique%7C"
1354 .
"Mod%C3%A8le%3AHomonymie%20vid%C3%A9oludique%7CMod%C3%A8le%3AHomonymie%20%C3%A9difice%20religieux%7C"
1355 .
"Mod%C3%A8le%3AInternationalisation%7CMod%C3%A8le%3AIsom%C3%A9rie%7CMod%C3%A8le%3AParonymie%7C"
1356 .
"Mod%C3%A8le%3APatronyme%7CMod%C3%A8le%3APatronyme%20basque%7CMod%C3%A8le%3APatronyme%20italien%7C"
1357 .
"Mod%C3%A8le%3APatronymie%7CMod%C3%A8le%3APersonnes%20homonymes%7CMod%C3%A8le%3ASaints%20homonymes%7C"
1358 .
"Mod%C3%A8le%3ATitres%20homonymes%7CMod%C3%A8le%3AToponymie%7CMod%C3%A8le%3AUnit%C3%A9s%20homonymes%7C"
1359 .
"Mod%C3%A8le%3AVilles%20homonymes%7CMod%C3%A8le%3A%C3%89difices%20religieux%20homonymes"
1371 $this->assertEquals(
1374 "romanNumeral('$num')"
1411 [ 1989,
'MCMLXXXIX' ],
1417 [ 7000,
'MMMMMMM' ],
1418 [ 8000,
'MMMMMMMM' ],
1419 [ 9000,
'MMMMMMMMM' ],
1420 [ 9999,
'MMMMMMMMMCMXCIX' ],
1421 [ 10000,
'MMMMMMMMMM' ],
1430 $this->assertEquals(
1433 "hebrewNumeral('$num')"
1480 [ 2000,
"ב' אלפים" ],
1482 [ 3000,
"ג' אלפים" ],
1483 [ 4000,
"ד' אלפים" ],
1484 [ 4904,
"ד'תתק\"ד" ],
1485 [ 5000,
"ה' אלפים" ],
1486 [ 5680,
"ה'תר\"ף" ],
1487 [ 5690,
"ה'תר\"ץ" ],
1488 [ 5708,
"ה'תש\"ח" ],
1489 [ 5720,
"ה'תש\"ך" ],
1490 [ 5740,
"ה'תש\"ם" ],
1491 [ 5750,
"ה'תש\"ן" ],
1492 [ 5775,
"ה'תשע\"ה" ],
1501 $chosen = $this->
getLang()->convertPlural( $number, $forms );
1502 $this->assertEquals( $expected, $chosen );
1509 'singular',
'plural'
1511 [
'explicit zero', 0, [
1512 '0=explicit zero',
'singular',
'plural'
1514 [
'explicit one', 1, [
1515 'singular',
'plural',
'1=explicit one',
1518 'singular',
'plural',
'0=explicit zero',
1521 '0=explicit zero',
'1=explicit one',
'singular',
'plural'
1523 [
'explicit eleven', 11, [
1524 'singular',
'plural',
'11=explicit eleven',
1527 'singular',
'plural',
'11=explicit twelve',
1530 'singular',
'plural',
'=explicit form',
1533 'kissa=kala',
'1=2=3',
'other',
1536 '0=explicit zero',
'1=explicit one',
1545 $lre =
"\xE2\x80\xAA";
1546 $rle =
"\xE2\x80\xAB";
1547 $pdf =
"\xE2\x80\xAC";
1549 $this->assertEquals(
1551 $lang->embedBidi(
'123' ),
1552 'embedBidi with neutral argument'
1554 $this->assertEquals(
1555 $lre .
'Ben_(WMF)' . $pdf,
1556 $lang->embedBidi(
'Ben_(WMF)' ),
1557 'embedBidi with LTR argument'
1559 $this->assertEquals(
1560 $rle .
'יהודי (מנוחין)' . $pdf,
1561 $lang->embedBidi(
'יהודי (מנוחין)' ),
1562 'embedBidi with RTL argument'
1572 if ( is_array( $expectedData ) ) {
1573 list( $func, $arg ) = $expectedData;
1574 $expected =
$lang->$func( $arg );
1576 $expected = $expectedData;
1578 $this->assertEquals( $expected,
$lang->translateBlockExpiry( $str ), $desc );
1583 [
'2 hours',
'2 hours',
'simple data from ipboptions' ],
1584 [
'indefinite',
'infinite',
'infinite from ipboptions' ],
1585 [
'indefinite',
'infinity',
'alternative infinite from ipboptions' ],
1586 [
'indefinite',
'indefinite',
'another alternative infinite from ipboptions' ],
1587 [ [
'formatDuration', 1023 * 60 * 60 ],
'1023 hours',
'relative' ],
1588 [ [
'formatDuration', -1023 ],
'-1023 seconds',
'negative relative' ],
1589 [ [
'formatDuration', 0 ],
'now',
'now' ],
1591 [
'timeanddate',
'20120102070000' ],
1592 '2012-1-1 7:00 +1 day',
1593 'mixed, handled as absolute'
1595 [ [
'timeanddate',
'19910203040506' ],
'1991-2-3 4:05:06',
'absolute' ],
1596 [ [
'timeanddate',
'19700101000000' ],
'1970-1-1 0:00:00',
'absolute at epoch' ],
1597 [ [
'timeanddate',
'19691231235959' ],
'1969-12-31 23:59:59',
'time before epoch' ],
1598 [
'dummy',
'dummy',
'return garbage as is' ],
1608 $localisedNum =
$lang->formatNum( $number );
1609 $normalisedNum =
$lang->parseFormattedNumber( $localisedNum );
1611 $this->assertEquals( $number, $normalisedNum );
1621 [
'zh-classical', 7432 ]
1630 $this->assertEquals(
1632 $this->
getLang()->commafy( $number ),
1633 "commafy('$number')"
1643 [ 10000,
'10,000' ],
1644 [ 100000,
'100,000' ],
1645 [ 1000000,
'1,000,000' ],
1646 [ -1.0001,
'-1.0001' ],
1647 [ 1.0001,
'1.0001' ],
1648 [ 10.0001,
'10.0001' ],
1649 [ 100.0001,
'100.0001' ],
1650 [ 1000.0001,
'1,000.0001' ],
1651 [ 10000.0001,
'10,000.0001' ],
1652 [ 100000.0001,
'100,000.0001' ],
1653 [ 1000000.0001,
'1,000,000.0001' ],
1654 [
'200000000000000000000',
'200,000,000,000,000,000,000' ],
1655 [
'-200000000000000000000',
'-200,000,000,000,000,000,000' ],
1664 $and =
$lang->getMessageFromDB(
'and' );
1665 $s =
$lang->getMessageFromDB(
'word-separator' );
1666 $c =
$lang->getMessageFromDB(
'comma-separator' );
1668 $this->assertEquals(
'',
$lang->listToText( [] ) );
1669 $this->assertEquals(
'a',
$lang->listToText( [
'a' ] ) );
1670 $this->assertEquals(
"a{$and}{$s}b",
$lang->listToText( [
'a',
'b' ] ) );
1671 $this->assertEquals(
"a{$c}b{$and}{$s}c",
$lang->listToText( [
'a',
'b',
'c' ] ) );
1672 $this->assertEquals(
"a{$c}b{$c}c{$and}{$s}d",
$lang->listToText( [
'a',
'b',
'c',
'd' ] ) );
1685 [
'en',
true,
'is supported language' ],
1686 [
'fi',
true,
'is supported language' ],
1687 [
'bunny',
false,
'is not supported language' ],
1688 [
'FI',
false,
'is not supported language, input should be in lower case' ],
1698 if ( is_null( $expected ) ) {
1701 $this->assertEquals( $expected,
$lang->getParentLanguage()->getCode(),
$comment );
1707 [
'zh-cn',
'zh',
'zh is the parent language of zh-cn' ],
1708 [
'zh',
'zh',
'zh is defined as the parent language of zh, '
1709 .
'because zh converter can convert zh-cn to zh' ],
1710 [
'zh-invalid', null,
'do not be fooled by arbitrarily composed language codes' ],
1711 [
'en-gb', null,
'en does not have converter' ],
1712 [
'en', null,
'en does not have converter. Although FakeConverter '
1713 .
'handles en -> en conversion but it is useless' ],
1723 $aliases = $language->getNamespaceAliases();
1724 foreach ( $subset
as $alias => $nsId ) {
1725 $this->assertEquals( $nsId, $aliases[$alias] );
testSprintfDateTooShortTimestamp()
Test too short timestamp MWException Language::sprintfDate.
testFormatSize($size, $expected, $msg)
provideFormatSizes Language::formatSize
parseFormattedNumberProvider()
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
static isKnownLanguageTag($tag)
Returns true if a language code is an IETF tag known to MediaWiki.
testTranslateBlockExpiry($expectedData, $str, $desc)
Language::translateBlockExpiry() provideTranslateBlockExpiry.
static provideSprintfDateSamples()
testFormatTimePeriod($seconds, $format, $expected, $desc)
provideFormattableTimes Language::formatTimePeriod
testFormatBitrate($bps, $expected, $msg)
provideFormatBitrate Language::formatBitrate
static providePluralData()
static isWellFormedLanguageTag($code, $lenient=false)
Returns true if a language code string is a well-formed language tag according to RFC 5646...
static provideUnknownLanguageTags()
testMalformedLanguageTag($code, $message= '')
Negative test for Language::isWellFormedLanguageTag() provideMalformedLanguageTags Language::isWellFo...
testLanguageConvertDoubleWidthToSingleWidth()
Language::convertDoubleWidth Language::normalizeForSearch.
testBuiltInCodeValidation($code, $expected, $message= '')
Test Language::isValidBuiltInCode() provideLanguageCodes Language::isValidBuiltInCode.
if(!isset($args[0])) $lang
testSprintfDateNoZone($format, $ts, $expected, $ignore, $msg)
sprintfDate should always use UTC when no zone is given.
static provideHTMLTruncateData()
static provideCommafyData()
testSprintfDateNotAllDigitTimestamp()
Test too short timestamp MWException Language::sprintfDate.
testGetNamespaceAliases($languageCode, $subset)
provideGetNamespaceAliases Language::getNamespaceAliases
testFormatDuration($duration, $expected, $intervals=[])
provideFormatDuration Language::formatDuration
testEmbedBidi()
Language::embedBidi()
static provideHebrewNumeralsData()
testLenientLanguageTag()
Negative test for Language::isWellFormedLanguageTag() Language::isWellFormedLanguageTag.
static provideMalformedLanguageTags()
The test cases are based on the tests in the GaBuZoMeu parser written by Stéphane Bortzmeyer bortzmey...
static provideLanguageCodes()
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
testCommafy($number, $numbersWithCommas)
Language::commafy() provideCommafyData.
testListToText()
Language::listToText.
static provideKnownLanguageTags()
static provideTranslateBlockExpiry()
testSprintfDate($format, $ts, $expected, $msg)
provideSprintfDateSamples Language::sprintfDate
static hebrewNumeral($num)
Hebrew Gematria number formatting up to 9999.
testConvertPlural($expected, $number, $forms)
providePluralData Language::convertPlural
static isValidBuiltInCode($code)
Returns true if a language code is of a valid form for the purposes of internal customisation of Medi...
testSprintfDateTZ($format, $ts, $ignore, $expected, $msg)
sprintfDate should use passed timezone provideSprintfDateSamples Language::sprintfDate ...
static provideGetNamespaceAliases()
testIsSupportedLanguage($code, $expected, $comment)
provideIsSupportedLanguage Language::isSupportedLanguage
testCheckTitleEncoding($s)
provideCheckTitleEncodingData Language::checkTitleEncoding
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
testTruncateHtml($len, $ellipsis, $input, $expected)
provideHTMLTruncateData Language::truncateHTML
testKnownLanguageTag($code, $message= '')
Test Language::isKnownLanguageTag() provideKnownLanguageTags Language::isKnownLanguageTag.
testKnownCldrLanguageTag()
Language::isKnownLanguageTag.
testParseFormattedNumber($langCode, $number)
parseFormattedNumberProvider
testGetParentLanguage($code, $expected, $comment)
provideGetParentLanguage Language::getParentLanguage
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static provideRomanNumeralsData()
static romanNumeral($num)
Roman number formatting up to 10000.
testWellFormedLanguageTag($code, $message= '')
Test Language::isWellFormedLanguageTag() provideWellFormedLanguageTags Language::isWellFormedLanguage...
static provideFormatDuration()
static provideGetParentLanguage()
static provideFormattableTimes()
testUnknownLanguageTag($code, $message= '')
Negative tests for Language::isKnownLanguageTag() provideUnKnownLanguageTags Language::isKnownLanguag...
static provideFormatBitrate()
testHebrewNumeral($num, $numerals)
provideHebrewNumeralsData Language::hebrewNumeral
static provideFormatSizes()
testRomanNumerals($num, $numerals)
provideRomanNumeralsData Language::romanNumeral
testSprintfDateTooLongTimestamp()
Test too long timestamp MWException Language::sprintfDate.
static factory($code)
Get a cached or new language object for a given language code.
static provideCheckTitleEncodingData()
Helping class to run tests using a clean language instance.
static isSupportedLanguage($code)
Checks whether any localisation is available for that language tag in MediaWiki (MessagesXx.php exists).
static provideIsSupportedLanguage()
testTruncate()
Language::truncate.
static provideWellFormedLanguageTags()
The test cases are based on the tests in the GaBuZoMeu parser written by Stéphane Bortzmeyer bortzmey...