Add PHPUnit tests for plural rules. For languages cs, cu, cy, dsb, fr, ga, gd, gv, hr, hsb, hy, ksh, ln
2012-01-27 11:13:06 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* @author Santhosh Thottingal
|
Correct the plural forms for Manx (Gaelg)
Backported the plural rules from CLDR 24 as an override to CLDR 23 rules
exising in MediaWiki. The syntax for plural rules changed in CLDR 24, so
modified the syntax to fit the CLDR 23 syntax
Once we are ready with the updated parsers for CLDR 24(See bug 56931),
we should remove the override.
Since we remove the custom plural forms in MW in favor of CLDR,
the following changes comes into effect:
1. 'few' form used as 'zero' form in MW. Practially that make 'one' form used
as 'two' form and 'two' used as 'few' form.
This breaks existing gv {{PURAL}} usage as dicussed in the bug report
2. CLDR defines 'few' form as n % 100 = 0,20,40,60 but MW adds 80 also to that
list, ie n % 100 = 0,20,40,60, 80. So with this patch, 80 is no longer considered
as 'few' plural form.
Bug: 47099
Change-Id: I46ab3dadc7fe08c1e60bbd81a1ee841e166e9608
2013-12-11 06:35:43 +00:00
|
|
|
* @copyright Copyright © 2013, Santhosh Thottingal
|
Add PHPUnit tests for plural rules. For languages cs, cu, cy, dsb, fr, ga, gd, gv, hr, hsb, hy, ksh, ln
2012-01-27 11:13:06 +00:00
|
|
|
* @file
|
|
|
|
|
*/
|
|
|
|
|
|
2020-01-27 17:06:18 +00:00
|
|
|
/**
|
2021-07-31 21:23:21 +00:00
|
|
|
* Tests for Manx (Gaelg)
|
|
|
|
|
*
|
2020-01-27 17:06:18 +00:00
|
|
|
* @group Language
|
|
|
|
|
*/
|
2012-10-23 20:53:17 +00:00
|
|
|
class LanguageGvTest extends LanguageClassesTestCase {
|
2013-10-22 10:32:29 +00:00
|
|
|
/**
|
|
|
|
|
* @dataProvider providePlural
|
|
|
|
|
* @covers Language::convertPlural
|
|
|
|
|
*/
|
|
|
|
|
public function testPlural( $result, $value ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$forms = [ 'one', 'two', 'few', 'other' ];
|
2012-10-23 20:53:17 +00:00
|
|
|
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
|
Add PHPUnit tests for plural rules. For languages cs, cu, cy, dsb, fr, ga, gd, gv, hr, hsb, hy, ksh, ln
2012-01-27 11:13:06 +00:00
|
|
|
}
|
2013-02-15 10:27:48 +00:00
|
|
|
|
2013-10-22 10:32:29 +00:00
|
|
|
/**
|
|
|
|
|
* @dataProvider providePlural
|
|
|
|
|
* @covers Language::getPluralRuleType
|
|
|
|
|
*/
|
|
|
|
|
public function testGetPluralRuleType( $result, $value ) {
|
2013-01-25 01:10:37 +00:00
|
|
|
$this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-22 02:12:37 +00:00
|
|
|
public static function providePlural() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'few', 0 ],
|
|
|
|
|
[ 'one', 1 ],
|
|
|
|
|
[ 'two', 2 ],
|
|
|
|
|
[ 'other', 3 ],
|
|
|
|
|
[ 'few', 20 ],
|
|
|
|
|
[ 'one', 21 ],
|
|
|
|
|
[ 'two', 22 ],
|
|
|
|
|
[ 'other', 23 ],
|
|
|
|
|
[ 'other', 50 ],
|
|
|
|
|
[ 'few', 60 ],
|
|
|
|
|
[ 'few', 80 ],
|
|
|
|
|
[ 'few', 100 ]
|
|
|
|
|
];
|
Add PHPUnit tests for plural rules. For languages cs, cu, cy, dsb, fr, ga, gd, gv, hr, hsb, hy, ksh, ln
2012-01-27 11:13:06 +00:00
|
|
|
}
|
|
|
|
|
}
|