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
|
2013-02-14 10:26:13 +00:00
|
|
|
* @copyright Copyright © 2012-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
|
|
|
|
|
*/
|
|
|
|
|
|
2021-07-31 21:23:21 +00:00
|
|
|
/**
|
2020-01-27 17:06:18 +00:00
|
|
|
* @group Language
|
|
|
|
|
*/
|
2012-10-23 20:53:17 +00:00
|
|
|
class LanguageGdTest extends LanguageClassesTestCase {
|
2013-10-22 10:32:29 +00:00
|
|
|
/**
|
|
|
|
|
* @dataProvider providerPlural
|
|
|
|
|
* @covers Language::convertPlural
|
2014-04-30 18:53:31 +00:00
|
|
|
*/
|
2013-10-22 10:32:29 +00:00
|
|
|
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-03-22 02:12:37 +00:00
|
|
|
public static function providerPlural() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'other', 0 ],
|
|
|
|
|
[ 'one', 1 ],
|
|
|
|
|
[ 'two', 2 ],
|
|
|
|
|
[ 'one', 11 ],
|
|
|
|
|
[ 'two', 12 ],
|
|
|
|
|
[ 'few', 3 ],
|
|
|
|
|
[ 'few', 19 ],
|
|
|
|
|
[ 'other', 200 ],
|
|
|
|
|
];
|
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-10-22 10:32:29 +00:00
|
|
|
/**
|
|
|
|
|
* @dataProvider providerPluralExplicit
|
|
|
|
|
* @covers Language::convertPlural
|
|
|
|
|
*/
|
|
|
|
|
public function testExplicitPlural( $result, $value ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$forms = [ 'one', 'two', 'few', 'other', '11=Form11', '12=Form12' ];
|
2013-02-14 10:26:13 +00:00
|
|
|
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-22 02:12:37 +00:00
|
|
|
public static function providerPluralExplicit() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'other', 0 ],
|
|
|
|
|
[ 'one', 1 ],
|
|
|
|
|
[ 'two', 2 ],
|
|
|
|
|
[ 'Form11', 11 ],
|
|
|
|
|
[ 'Form12', 12 ],
|
|
|
|
|
[ 'few', 3 ],
|
|
|
|
|
[ 'few', 19 ],
|
|
|
|
|
[ 'other', 200 ],
|
|
|
|
|
];
|
2013-02-14 10:26:13 +00:00
|
|
|
}
|
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
|
|
|
}
|