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
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** Tests for MediaWiki languages/classes/LanguageGd.php */
|
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 ) {
|
2013-02-14 10:26:13 +00:00
|
|
|
$forms = array( '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() {
|
2013-03-25 23:27:14 +00:00
|
|
|
return array(
|
2013-02-14 10:26:13 +00:00
|
|
|
array( 'other', 0 ),
|
|
|
|
|
array( 'one', 1 ),
|
|
|
|
|
array( 'two', 2 ),
|
|
|
|
|
array( 'one', 11 ),
|
|
|
|
|
array( 'two', 12 ),
|
|
|
|
|
array( 'few', 3 ),
|
|
|
|
|
array( 'few', 19 ),
|
|
|
|
|
array( '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 ) {
|
2013-02-14 10:26:13 +00:00
|
|
|
$forms = array( 'one', 'two', 'few', 'other', '11=Form11', '12=Form12' );
|
|
|
|
|
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-22 02:12:37 +00:00
|
|
|
public static function providerPluralExplicit() {
|
2013-03-25 23:27:14 +00:00
|
|
|
return array(
|
|
|
|
|
array( 'other', 0 ),
|
|
|
|
|
array( 'one', 1 ),
|
|
|
|
|
array( 'two', 2 ),
|
|
|
|
|
array( 'Form11', 11 ),
|
|
|
|
|
array( 'Form12', 12 ),
|
|
|
|
|
array( 'few', 3 ),
|
|
|
|
|
array( 'few', 19 ),
|
|
|
|
|
array( '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
|
|
|
}
|