Go to the documentation of this file.
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 array(
'noabbrevs' =>
true ),
38 'formatTimePeriod() rounding (<10s)'
44 'formatTimePeriod() rounding (<10s)'
48 array(
'noabbrevs' =>
true ),
50 'formatTimePeriod() rounding (<10s)'
56 'formatTimePeriod() rounding (<60s)'
60 array(
'noabbrevs' =>
true ),
62 'formatTimePeriod() rounding (<60s)'
68 'formatTimePeriod() rounding (<1h)'
72 array(
'noabbrevs' =>
true ),
73 '2 minutes 0 seconds',
74 'formatTimePeriod() rounding (<1h)'
80 'formatTimePeriod() rounding (<1h)'
84 array(
'noabbrevs' =>
true ),
85 '1 hour 0 minutes 0 seconds',
86 'formatTimePeriod() rounding (<1h)'
92 'formatTimePeriod() rounding (>=1h)'
96 array(
'noabbrevs' =>
true ),
97 '2 hours 0 minutes 0 seconds',
98 'formatTimePeriod() rounding (>=1h)'
104 'formatTimePeriod() rounding (>=1h), avoidseconds'
108 array(
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ),
110 'formatTimePeriod() rounding (>=1h), avoidseconds'
116 'formatTimePeriod() rounding (>=1h), avoidminutes'
120 array(
'avoid' =>
'avoidminutes',
'noabbrevs' =>
true ),
122 'formatTimePeriod() rounding (>=1h), avoidminutes'
128 'formatTimePeriod() rounding (=48h), avoidseconds'
132 array(
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ),
133 '48 hours 0 minutes',
134 'formatTimePeriod() rounding (=48h), avoidseconds'
140 'formatTimePeriod() rounding (>48h), avoidminutes'
144 array(
'avoid' =>
'avoidminutes',
'noabbrevs' =>
true ),
146 'formatTimePeriod() rounding (>48h), avoidminutes'
152 'formatTimePeriod() rounding (>48h), avoidseconds'
156 array(
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ),
157 '2 days 1 hour 0 minutes',
158 'formatTimePeriod() rounding (>48h), avoidseconds'
164 'formatTimePeriod() rounding (>48h), avoidminutes'
168 array(
'avoid' =>
'avoidminutes',
'noabbrevs' =>
true ),
170 'formatTimePeriod() rounding (>48h), avoidminutes'
176 'formatTimePeriod() rounding (>48h), avoidseconds'
180 array(
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ),
181 '3 days 0 hours 0 minutes',
182 'formatTimePeriod() rounding (>48h), avoidseconds'
188 'formatTimePeriod() rounding, (>48h), avoidseconds'
192 array(
'avoid' =>
'avoidseconds',
'noabbrevs' =>
true ),
193 '2 days 0 hours 0 minutes',
194 'formatTimePeriod() rounding, (>48h), avoidseconds'
200 'formatTimePeriod() rounding, recursion, (>48h)'
204 array(
'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'
274 $this->
getLang()->truncateHTML( $input, $len, $ellipsis )
283 array( 0,
'XXX',
"1234567890",
"XXX" ),
284 array( 8,
'XXX',
"1234567890",
"12345XXX" ),
285 array( 5,
'XXXXXXXXXXXXXXX',
'1234567890',
"1234567890" ),
287 '<p><span style="font-weight:bold;"></span></p>',
288 '<p><span style="font-weight:bold;"></span></p>',
291 '<p><span style="font-weight:bold;">123456789</span></p>',
292 '<p><span style="font-weight:bold;">***</span></p>',
295 '<p><span style="font-weight:bold;"> 23456789</span></p>',
296 '<p><span style="font-weight:bold;">***</span></p>',
299 '<p><span style="font-weight:bold;">123456789</span></p>',
300 '<p><span style="font-weight:bold;">***</span></p>',
303 '<p><span style="font-weight:bold;">123456789</span></p>',
304 '<p><span style="font-weight:bold;">1***</span></p>',
307 '<tt><span style="font-weight:bold;">123456789</span></tt>',
308 '<tt><span style="font-weight:bold;">12***</span></tt>',
311 '<p><a href="www.mediawiki.org">123456789</a></p>',
312 '<p><a href="www.mediawiki.org">123***</a></p>',
315 '<p><a href="www.mediawiki.org">12 456789</a></p>',
316 '<p><a href="www.mediawiki.org">12 ***</a></p>',
319 '<small><span style="font-weight:bold;">123<p id="#moo">456</p>789</span></small>',
320 '<small><span style="font-weight:bold;">123<p id="#moo">4***</p></span></small>',
323 '<div><span style="font-weight:bold;">123<span>4</span>56789</span></div>',
324 '<div><span style="font-weight:bold;">123<span>4</span>5***</span></div>',
327 '<p><table style="font-weight:bold;"><tr><td>123456789</td></tr></table></p>',
328 '<p><table style="font-weight:bold;"><tr><td>123456789</td></tr></table></p>',
331 '<p><font style="font-weight:bold;">123456789</font></p>',
332 '<p><font style="font-weight:bold;">123456789</font></p>',
345 "validating code $code $message"
357 array(
'fr',
'two-letter code' ),
358 array(
'fr-latn',
'two-letter code with lower case script code' ),
359 array(
'fr-Latn-FR',
'two-letter code with title case script code and uppercase country code' ),
360 array(
'fr-Latn-419',
'two-letter code with title case script code and region number' ),
361 array(
'fr-FR',
'two-letter code with uppercase' ),
362 array(
'ax-TZ',
'Not in the registry, but well-formed' ),
363 array(
'fr-shadok',
'two-letter code with variant' ),
364 array(
'fr-y-myext-myext2',
'non-x singleton' ),
365 array(
'fra-Latn',
'ISO 639 can be 3-letters' ),
366 array(
'fra',
'three-letter language code' ),
367 array(
'fra-FX',
'three-letter language code with country code' ),
368 array(
'i-klingon',
'grandfathered with singleton' ),
369 array(
'I-kLINgon',
'tags are case-insensitive...' ),
370 array(
'no-bok',
'grandfathered without singleton' ),
371 array(
'i-enochian',
'Grandfathered' ),
372 array(
'x-fr-CH',
'private use' ),
373 array(
'es-419',
'two-letter code with region number' ),
374 array(
'en-Latn-GB-boont-r-extended-sequence-x-private',
'weird, but well-formed' ),
375 array(
'ab-x-abc-x-abc',
'anything goes after x' ),
376 array(
'ab-x-abc-a-a',
'anything goes after x, including several non-x singletons' ),
377 array(
'i-default',
'grandfathered' ),
378 array(
'abcd-Latn',
'Language of 4 chars reserved for future use' ),
379 array(
'AaBbCcDd-x-y-any-x',
'Language of 5-8 chars, registered' ),
380 array(
'de-CH-1901',
'with country and year' ),
381 array(
'en-US-x-twain',
'with country and singleton' ),
382 array(
'zh-cmn',
'three-letter variant' ),
383 array(
'zh-cmn-Hant',
'three-letter variant and script' ),
384 array(
'zh-cmn-Hant-HK',
'three-letter variant, script and country' ),
385 array(
'xr-p-lze',
'Extension' ),
397 "validating that code $code is a malformed language tag - $message"
409 array(
'f',
'language too short' ),
410 array(
'f-Latn',
'language too short with script' ),
411 array(
'xr-lxs-qut',
'variants too short' ), # extlangS
412 array(
'fr-Latn-F',
'region too short' ),
413 array(
'a-value',
'language too short with region' ),
414 array(
'tlh-a-b-foo',
'valid three-letter with wrong variant' ),
415 array(
'i-notexist',
'grandfathered but not registered: invalid, even if we only test well-formedness' ),
416 array(
'abcdefghi-012345678',
'numbers too long' ),
417 array(
'ab-abc-abc-abc-abc',
'invalid extensions' ),
418 array(
'ab-abcd-abc',
'invalid extensions' ),
419 array(
'ab-ab-abc',
'invalid extensions' ),
420 array(
'ab-123-abc',
'invalid extensions' ),
421 array(
'a-Hant-ZH',
'short language with valid extensions' ),
422 array(
'a1-Hant-ZH',
'invalid character in language' ),
423 array(
'ab-abcde-abc',
'invalid extensions' ),
424 array(
'ab-1abc-abc',
'invalid characters in extensions' ),
425 array(
'ab-ab-abcd',
'invalid order of extensions' ),
426 array(
'ab-123-abcd',
'invalid order of extensions' ),
427 array(
'ab-abcde-abcd',
'invalid extensions' ),
428 array(
'ab-1abc-abcd',
'invalid characters in extensions' ),
429 array(
'ab-a-b',
'extensions too short' ),
430 array(
'ab-a-x',
'extensions too short, even with singleton' ),
431 array(
'ab--ab',
'two separators' ),
432 array(
'ab-abc-',
'separator in the end' ),
433 array(
'-ab-abc',
'separator in the beginning' ),
434 array(
'abcd-efg',
'language too long' ),
435 array(
'aabbccddE',
'tag too long' ),
436 array(
'pa_guru',
'A tag with underscore is invalid in strict mode' ),
437 array(
'de-f',
'subtag too short' ),
448 'pa_guru is a well-formed language tag in lenient mode'
460 "validating code $code $message"
470 "reject underscore in language code"
476 array(
'fr',
'Two letters, minor case' ),
477 array(
'EN',
'Two letters, upper case' ),
478 array(
'tyv',
'Three letters' ),
479 array(
'tokipona',
'long language code' ),
480 array(
'be-tarask',
'With dash' ),
481 array(
'Zh-classical',
'Begin with upper case, dash' ),
482 array(
'Be-x-old',
'With extension (two dashes)' ),
494 "validating code $code - $message"
500 array(
'fr',
'simple code' ),
501 array(
'bat-smg',
'an MW legacy tag' ),
502 array(
'sgs',
'an internal standard MW name, for which a legacy tag is used externally' ),
510 if ( !class_exists(
'LanguageNames' ) ) {
511 $this->markTestSkipped(
'The LanguageNames class is not available. The cldr extension is probably not installed.' );
516 'validating code "pal" an ancient language, which probably will not appear in Names.php, but appears in CLDR in English'
528 "checking that code $code is invalid - $message"
534 array(
'mw',
'non-existent two-letter code' ),
535 array(
'foo"<bar',
'very invalid language code' ),
545 $this->
getLang()->sprintfDate(
'xiY',
'1234567890123' );
554 $this->
getLang()->sprintfDate(
'xiY',
'123456789012345' );
563 $this->
getLang()->sprintfDate(
'xiY',
'-1234567890123' );
573 $this->
getLang()->sprintfDate( $format, $ts ),
574 "sprintfDate('$format', '$ts'): $msg"
584 $oldTZ = date_default_timezone_get();
585 $res = date_default_timezone_set(
'Asia/Seoul' );
587 $this->markTestSkipped(
"Error setting Timezone" );
592 $this->
getLang()->sprintfDate( $format, $ts ),
593 "sprintfDate('$format', '$ts'): $msg"
596 date_default_timezone_set( $oldTZ );
605 $tz =
new DateTimeZone(
'Asia/Seoul' );
607 $this->markTestSkipped(
"Error getting Timezone" );
612 $this->
getLang()->sprintfDate( $format, $ts, $tz ),
613 "sprintfDate('$format', '$ts', 'Asia/Seoul'): $msg"
624 'Iranian calendar full year'
631 'Iranian calendar short year'
638 'ISO 8601 (week) year'
688 'Month index, not zero pad'
695 'Month index. Zero pad'
716 'Genitive month name (same in EN)'
723 'Day of month (not zero pad)'
730 'Day of month (zero-pad)'
737 'Day of year (zero-indexed)'
744 'Day of week (abbrev)'
758 'Day of week (Mon=1, Sun=7)'
765 'Day of week (Sun=0, Sat=6)'
807 '12 hour, zero padded'
856 'Days in current month'
861 '2012-01-02T09:07:05+00:00',
862 '2012-01-02T09:07:05+09:00',
868 'Mon, 02 Jan 2012 09:07:05 +0000',
869 'Mon, 02 Jan 2012 09:07:05 +0900',
877 'Timezone identifier'
898 'Timezone offset with colon'
905 'Timezone abbreviation'
912 'Timezone offset in seconds'
940 'Hebrew number of days in month'
947 'Hebrew genitive month name (No difference in EN)'
989 'Raw numerals (doesn\'t mean much in EN)'
992 '[[Y "(yea"\\r)]] \\"xx\\"',
994 '[[2012 (year)]] "x"',
995 '[[2012 (year)]] "x"',
1007 $this->assertEquals(
1010 "formatSize('$size'): $msg"
1070 $this->assertEquals(
1072 $this->
getLang()->formatBitrate( $bps ),
1073 "formatBitrate('$bps'): $msg"
1087 "999 bits per second"
1092 "1 kilobit per second"
1097 "1 megabit per second"
1102 "1 gigabit per second"
1107 "1 terabit per second"
1112 "1 petabit per second"
1117 "1 exabit per second"
1122 "1 zetabit per second"
1127 "1 yottabit per second"
1132 "1,000 yottabits per second"
1142 $this->assertEquals(
1144 $this->
getLang()->formatDuration( $duration, $intervals ),
1145 "formatDuration('$duration'): $expected"
1189 ( 365 + ( 24 * 3 + 25 ) / 400.0 ) * 86400,
1222 '2 hours, 30 minutes and 1 second'
1226 '1 hour and 1 second'
1229 31556952 + 2 * 86400 + 9000,
1230 '1 year, 2 days, 2 hours and 30 minutes'
1233 42 * 1000 * 31556952 + 42,
1234 '42 millennia and 42 seconds'
1252 31556952 + 2 * 86400 + 9000,
1253 '1 year, 2 days and 150 minutes',
1254 array(
'years',
'days',
'minutes' ),
1259 array(
'years',
'days' ),
1262 31556952 + 2 * 86400 + 9000,
1263 '1 year, 2 days and 150 minutes',
1264 array(
'minutes',
'days',
'years' ),
1269 array(
'days',
'years' ),
1279 $this->assertEquals(
1281 $this->
getLang()->checkTitleEncoding(
$s ),
1282 "checkTitleEncoding('$s')"
1289 array(
"United States of America" ),
1290 array( rawurldecode(
"S%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e" ) ),
1293 "Acteur%7CAlbert%20Robbins%7CAnglais%7CAnn%20Donahue%7CAnthony%20E.%20Zuiker%7CCarol%20Mendelsohn"
1301 "Acteur%7CAlbert%20Robbins%7CAnglais%7CAnn%20Donahue%7CAnthony%20E.%20Zuiker%7CCarol%20Mendelsohn%7C"
1302 .
"Catherine%20Willows%7CDavid%20Hodges%7CDavid%20Phillips%7CGil%20Grissom%7CGreg%20Sanders%7CHodges%7C"
1303 .
"Internet%20Movie%20Database%7CJim%20Brass%7CLady%20Heather%7C"
1304 .
"Les%20Experts%20(s%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e)%7CLes%20Experts%20:%20Manhattan%7C"
1305 .
"Les%20Experts%20:%20Miami%7CListe%20des%20personnages%20des%20Experts%7C"
1306 .
"Liste%20des%20%C3%A9pisodes%20des%20Experts%7CMod%C3%A8le%20discussion:Palette%20Les%20Experts%7C"
1307 .
"Nick%20Stokes%7CPersonnage%20de%20fiction%7CPersonnage%20fictif%7CPersonnage%20de%20fiction%7C"
1308 .
"Personnages%20r%C3%A9currents%20dans%20Les%20Experts%7CRaymond%20Langston%7CRiley%20Adams%7C"
1309 .
"Saison%201%20des%20Experts%7CSaison%2010%20des%20Experts%7CSaison%2011%20des%20Experts%7C"
1310 .
"Saison%2012%20des%20Experts%7CSaison%202%20des%20Experts%7CSaison%203%20des%20Experts%7C"
1311 .
"Saison%204%20des%20Experts%7CSaison%205%20des%20Experts%7CSaison%206%20des%20Experts%7C"
1312 .
"Saison%207%20des%20Experts%7CSaison%208%20des%20Experts%7CSaison%209%20des%20Experts%7C"
1313 .
"Sara%20Sidle%7CSofia%20Curtis%7CS%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e%7CWallace%20Langham%7C"
1314 .
"Warrick%20Brown%7CWendy%20Simms%7C%C3%89tats-Unis"
1319 "Mod%C3%A8le%3AArrondissements%20homonymes%7CMod%C3%A8le%3ABandeau%20standard%20pour%20page%20d'homonymie%7C"
1320 .
"Mod%C3%A8le%3ABatailles%20homonymes%7CMod%C3%A8le%3ACantons%20homonymes%7C"
1321 .
"Mod%C3%A8le%3ACommunes%20fran%C3%A7aises%20homonymes%7CMod%C3%A8le%3AFilms%20homonymes%7C"
1322 .
"Mod%C3%A8le%3AGouvernements%20homonymes%7CMod%C3%A8le%3AGuerres%20homonymes%7CMod%C3%A8le%3AHomonymie%7C"
1323 .
"Mod%C3%A8le%3AHomonymie%20bateau%7CMod%C3%A8le%3AHomonymie%20d'%C3%A9tablissements%20scolaires%20ou"
1324 .
"%20universitaires%7CMod%C3%A8le%3AHomonymie%20d'%C3%AEles%7CMod%C3%A8le%3AHomonymie%20de%20clubs%20sportifs%7C"
1325 .
"Mod%C3%A8le%3AHomonymie%20de%20comt%C3%A9s%7CMod%C3%A8le%3AHomonymie%20de%20monument%7C"
1326 .
"Mod%C3%A8le%3AHomonymie%20de%20nom%20romain%7CMod%C3%A8le%3AHomonymie%20de%20parti%20politique%7C"
1327 .
"Mod%C3%A8le%3AHomonymie%20de%20route%7CMod%C3%A8le%3AHomonymie%20dynastique%7C"
1328 .
"Mod%C3%A8le%3AHomonymie%20vid%C3%A9oludique%7CMod%C3%A8le%3AHomonymie%20%C3%A9difice%20religieux%7C"
1329 .
"Mod%C3%A8le%3AInternationalisation%7CMod%C3%A8le%3AIsom%C3%A9rie%7CMod%C3%A8le%3AParonymie%7C"
1330 .
"Mod%C3%A8le%3APatronyme%7CMod%C3%A8le%3APatronyme%20basque%7CMod%C3%A8le%3APatronyme%20italien%7C"
1331 .
"Mod%C3%A8le%3APatronymie%7CMod%C3%A8le%3APersonnes%20homonymes%7CMod%C3%A8le%3ASaints%20homonymes%7C"
1332 .
"Mod%C3%A8le%3ATitres%20homonymes%7CMod%C3%A8le%3AToponymie%7CMod%C3%A8le%3AUnit%C3%A9s%20homonymes%7C"
1333 .
"Mod%C3%A8le%3AVilles%20homonymes%7CMod%C3%A8le%3A%C3%89difices%20religieux%20homonymes"
1344 $this->assertEquals(
1347 "romanNumeral('$num')"
1366 array( 49,
'XLIX' ),
1370 array( 80,
'LXXX' ),
1372 array( 99,
'XCIX' ),
1375 array( 300,
'CCC' ),
1379 array( 700,
'DCC' ),
1380 array( 800,
'DCCC' ),
1382 array( 999,
'CMXCIX' ),
1384 array( 1989,
'MCMLXXXIX' ),
1385 array( 2000,
'MM' ),
1386 array( 3000,
'MMM' ),
1387 array( 4000,
'MMMM' ),
1388 array( 5000,
'MMMMM' ),
1389 array( 6000,
'MMMMMM' ),
1390 array( 7000,
'MMMMMMM' ),
1391 array( 8000,
'MMMMMMMM' ),
1392 array( 9000,
'MMMMMMMMM' ),
1393 array( 9999,
'MMMMMMMMMCMXCIX' ),
1394 array( 10000,
'MMMMMMMMMM' ),
1403 $chosen = $this->
getLang()->convertPlural( $number, $forms );
1404 $this->assertEquals( $expected, $chosen );
1411 'singular',
'plural'
1414 '0=explicit zero',
'singular',
'plural'
1417 'singular',
'plural',
'1=explicit one',
1420 'singular',
'plural',
'0=explicit zero',
1423 '0=explicit zero',
'1=explicit one',
'singular',
'plural'
1426 'singular',
'plural',
'11=explicit eleven',
1429 'singular',
'plural',
'11=explicit twelve',
1432 'singular',
'plural',
'=explicit form',
1435 'kissa=kala',
'1=2=3',
'other',
1438 '0=explicit zero',
'1=explicit one',
1449 if ( is_array( $expectedData ) ) {
1450 list( $func, $arg ) = $expectedData;
1451 $expected = $lang->$func( $arg );
1453 $expected = $expectedData;
1455 $this->assertEquals( $expected, $lang->translateBlockExpiry( $str ), $desc );
1460 array(
'2 hours',
'2 hours',
'simple data from ipboptions' ),
1461 array(
'indefinite',
'infinite',
'infinite from ipboptions' ),
1462 array(
'indefinite',
'infinity',
'alternative infinite from ipboptions' ),
1463 array(
'indefinite',
'indefinite',
'another alternative infinite from ipboptions' ),
1464 array(
array(
'formatDuration', 1023 * 60 * 60 ),
'1023 hours',
'relative' ),
1465 array(
array(
'formatDuration', -1023 ),
'-1023 seconds',
'negative relative' ),
1466 array(
array(
'formatDuration', 0 ),
'now',
'now' ),
1467 array(
array(
'timeanddate',
'20120102070000' ),
'2012-1-1 7:00 +1 day',
'mixed, handled as absolute' ),
1468 array(
array(
'timeanddate',
'19910203040506' ),
'1991-2-3 4:05:06',
'absolute' ),
1469 array(
array(
'timeanddate',
'19700101000000' ),
'1970-1-1 0:00:00',
'absolute at epoch' ),
1470 array(
array(
'timeanddate',
'19691231235959' ),
'1969-12-31 23:59:59',
'time before epoch' ),
1471 array(
'dummy',
'dummy',
'return garbage as is' ),
1480 $this->assertEquals(
1482 $this->
getLang()->commafy( $number ),
1483 "commafy('$number')"
1491 array( 100,
'100' ),
1492 array( 1000,
'1,000' ),
1493 array( 10000,
'10,000' ),
1494 array( 100000,
'100,000' ),
1495 array( 1000000,
'1,000,000' ),
1496 array( -1.0001,
'-1.0001' ),
1497 array( 1.0001,
'1.0001' ),
1498 array( 10.0001,
'10.0001' ),
1499 array( 100.0001,
'100.0001' ),
1500 array( 1000.0001,
'1,000.0001' ),
1501 array( 10000.0001,
'10,000.0001' ),
1502 array( 100000.0001,
'100,000.0001' ),
1503 array( 1000000.0001,
'1,000,000.0001' ),
1504 array(
'200000000000000000000',
'200,000,000,000,000,000,000' ),
1505 array(
'-200000000000000000000',
'-200,000,000,000,000,000,000' ),
1514 $and = $lang->getMessageFromDB(
'and' );
1515 $s = $lang->getMessageFromDB(
'word-separator' );
1516 $c = $lang->getMessageFromDB(
'comma-separator' );
1518 $this->assertEquals(
'', $lang->listToText(
array() ) );
1519 $this->assertEquals(
'a', $lang->listToText(
array(
'a' ) ) );
1520 $this->assertEquals(
"a{$and}{$s}b", $lang->listToText(
array(
'a',
'b' ) ) );
1521 $this->assertEquals(
"a{$c}b{$and}{$s}c", $lang->listToText(
array(
'a',
'b',
'c' ) ) );
1522 $this->assertEquals(
"a{$c}b{$c}c{$and}{$s}d", $lang->listToText(
array(
'a',
'b',
'c',
'd' ) ) );
1535 array(
'en',
true,
'is supported language' ),
1536 array(
'fi',
true,
'is supported language' ),
1537 array(
'bunny',
false,
'is not supported language' ),
1538 array(
'FI',
false,
'is not supported language, input should be in lower case' ),
1548 if ( is_null( $expected ) ) {
1549 $this->assertNull( $lang->getParentLanguage(),
$comment );
1551 $this->assertEquals( $expected, $lang->getParentLanguage()->getCode(),
$comment );
1557 array(
'zh-cn',
'zh',
'zh is the parent language of zh-cn' ),
1558 array(
'zh',
'zh',
'zh is defined as the parent language of zh, because zh converter can convert zh-cn to zh' ),
1559 array(
'zh-invalid',
null,
'do not be fooled by arbitrarily composed language codes' ),
1560 array(
'en-gb',
null,
'en does not have converter' ),
1561 array(
'en',
null,
'en does not have converter. Although FakeConverter handles en -> en conversion but it is useless' ),
1571 $aliases = $language->getNamespaceAliases();
1572 foreach ( $subset
as $alias => $nsId ) {
1573 $this->assertEquals( $nsId, $aliases[$alias] );
testLanguageConvertDoubleWidthToSingleWidth()
@covers Language::convertDoubleWidth @covers Language::normalizeForSearch
static provideCheckTitleEncodingData()
testMalformedLanguageTag( $code, $message='')
Negative test for Language::isWellFormedLanguageTag() @dataProvider provideMalformedLanguageTags @cov...
Helping class to run tests using a clean language instance.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
testFormatTimePeriod( $seconds, $format, $expected, $desc)
@dataProvider provideFormattableTimes# @covers Language::formatTimePeriod
static provideWellFormedLanguageTags()
The test cases are based on the tests in the GaBuZoMeu parser written by Stéphane Bortzmeyer bortzmey...
testKnownCldrLanguageTag()
@covers Language::isKnownLanguageTag
static provideCommafyData()
testUnknownLanguageTag( $code, $message='')
Negative tests for Language::isKnownLanguageTag() @dataProvider provideUnKnownLanguageTags @covers La...
testFormatSize( $size, $expected, $msg)
@dataProvider provideFormatSizes @covers Language::formatSize
testGetNamespaceAliases( $languageCode, $subset)
@dataProvider provideGetNamespaceAliases @covers Language::getNamespaceAliases
testCheckTitleEncoding( $s)
@dataProvider provideCheckTitleEncodingData @covers Language::checkTitleEncoding
static providePluralData()
testSprintfDate( $format, $ts, $expected, $msg)
@dataProvider provideSprintfDateSamples @covers Language::sprintfDate
static provideMalformedLanguageTags()
The test cases are based on the tests in the GaBuZoMeu parser written by Stéphane Bortzmeyer bortzmey...
testFormatBitrate( $bps, $expected, $msg)
@dataProvider provideFormatBitrate @covers Language::formatBitrate
static provideHTMLTruncateData()
static isWellFormedLanguageTag( $code, $lenient=false)
Returns true if a language code string is a well-formed language tag according to RFC 5646.
static provideFormatDuration()
testSprintfDateNoZone( $format, $ts, $expected, $ignore, $msg)
sprintfDate should always use UTC when no zone is given.
static isKnownLanguageTag( $tag)
Returns true if a language code is an IETF tag known to MediaWiki.
testSprintfDateTooLongTimestamp()
Test too long timestamp @expectedException MWException @covers Language::sprintfDate.
testKnownLanguageTag( $code, $message='')
Test Language::isKnownLanguageTag() @dataProvider provideKnownLanguageTags @covers Language::isKnownL...
testLenientLanguageTag()
Negative test for Language::isWellFormedLanguageTag() @covers Language::isWellFormedLanguageTag.
testListToText()
@covers Language::listToText
testRomanNumerals( $num, $numerals)
@dataProvider provideRomanNumeralsData @covers Language::romanNumeral
testTruncate()
@covers Language::truncate
static provideKnownLanguageTags()
static provideTranslateBlockExpiry()
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
static provideGetNamespaceAliases()
static provideIsSupportedLanguage()
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 provideSprintfDateSamples()
testGetParentLanguage( $code, $expected, $comment)
@dataProvider provideGetParentLanguage @covers Language::getParentLanguage
static isValidBuiltInCode( $code)
Returns true if a language code is of a valid form for the purposes of internal customisation of Medi...
while(false !==( $line=fgets( $in))) if(! $columns) $ignore
testConvertPlural( $expected, $number, $forms)
@dataProvider providePluralData @covers Language::convertPlural
testFormatDuration( $duration, $expected, $intervals=array())
@dataProvider provideFormatDuration @covers Language::formatDuration
testCommafy( $number, $numbersWithCommas)
@covers Language::commafy() @dataProvider provideCommafyData
static provideFormattableTimes()
testTranslateBlockExpiry( $expectedData, $str, $desc)
@covers Language::translateBlockExpiry() @dataProvider provideTranslateBlockExpiry
static provideFormatSizes()
testSprintfDateNotAllDigitTimestamp()
Test too short timestamp @expectedException MWException @covers Language::sprintfDate.
static provideFormatBitrate()
testBuiltInCodeValidation( $code, $message='')
Test Language::isValidBuiltInCode() @dataProvider provideLanguageCodes @covers Language::isValidBuilt...
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
static provideRomanNumeralsData()
static provideLanguageCodes()
static romanNumeral( $num)
Roman number formatting up to 10000.
static factory( $code)
Get a cached or new language object for a given language code.
testWellFormedLanguageTag( $code, $message='')
Test Language::isWellFormedLanguageTag() @dataProvider provideWellFormedLanguageTags @covers Language...
static provideGetParentLanguage()
static isSupportedLanguage( $code)
Checks whether any localisation is available for that language tag in MediaWiki (MessagesXx....
testBuiltInCodeValidationRejectUnderscore()
@covers Language::isValidBuiltInCode
testSprintfDateTZ( $format, $ts, $ignore, $expected, $msg)
sprintfDate should use passed timezone @dataProvider provideSprintfDateSamples @covers Language::spri...
testSprintfDateTooShortTimestamp()
Test too short timestamp @expectedException MWException @covers Language::sprintfDate.
testIsSupportedLanguage( $code, $expected, $comment)
@dataProvider provideIsSupportedLanguage @covers Language::isSupportedLanguage
testTruncateHtml( $len, $ellipsis, $input, $expected)
@dataProvider provideHTMLTruncateData @covers Language::truncateHTML
static provideUnknownLanguageTags()