3 * @author Amir E. Aharoni
4 * @copyright Copyright © 2012, Amir E. Aharoni
8 /** Tests for MediaWiki languages/classes/LanguageHe.php */
9 class LanguageHeTest
extends LanguageClassesTestCase
{
11 * The most common usage for the plural forms is two forms,
12 * for singular and plural. In this case, the second form
13 * is technically dual, but in practice it's used as plural.
14 * In some cases, usually with expressions of time, three forms
15 * are needed - singular, dual and plural.
16 * CLDR also specifies a fourth form for multiples of 10,
17 * which is very rare. It also has a mistake, because
18 * the number 10 itself is supposed to be just plural,
19 * so currently it's overridden in MediaWiki.
22 // @todo the below test*PluralForms test methods can be refactored
23 // to use a single test method and data provider..
26 * @dataProvider provideTwoPluralForms
27 * @covers Language::convertPlural
29 public function testTwoPluralForms( $result, $value ) {
30 $forms = array( 'one', 'other' );
31 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
35 * @dataProvider provideThreePluralForms
36 * @covers Language::convertPlural
38 public function testThreePluralForms( $result, $value ) {
39 $forms = array( 'one', 'two', 'other' );
40 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
44 * @dataProvider provideFourPluralForms
45 * @covers Language::convertPlural
47 public function testFourPluralForms( $result, $value ) {
48 $forms = array( 'one', 'two', 'many', 'other' );
49 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
53 * @dataProvider provideFourPluralForms
54 * @covers Language::convertPlural
56 public function testGetPluralRuleType( $result, $value ) {
57 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
60 public static function provideTwoPluralForms() {
62 array( 'other', 0 ), // Zero - plural
63 array( 'one', 1 ), // Singular
64 array( 'other', 2 ), // No third form provided, use it as plural
65 array( 'other', 3 ), // Plural - other
66 array( 'other', 10 ), // No fourth form provided, use it as plural
67 array( 'other', 20 ), // No fourth form provided, use it as plural
71 public static function provideThreePluralForms() {
73 array( 'other', 0 ), // Zero - plural
74 array( 'one', 1 ), // Singular
75 array( 'two', 2 ), // Dual
76 array( 'other', 3 ), // Plural - other
77 array( 'other', 10 ), // No fourth form provided, use it as plural
78 array( 'other', 20 ), // No fourth form provided, use it as plural
82 public static function provideFourPluralForms() {
84 array( 'other', 0 ), // Zero - plural
85 array( 'one', 1 ), // Singular
86 array( 'two', 2 ), // Dual
87 array( 'other', 3 ), // Plural - other
88 array( 'other', 10 ), // 10 is supposed to be plural (other), not "many"
89 array( 'many', 20 ), // Fourth form provided - rare, but supported by CLDR
94 * @dataProvider provideGrammar
95 * @covers Language::convertGrammar
97 public function testGrammar( $result, $word, $case ) {
98 $this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) );
101 // The comments in the beginning of the line help avoid RTL problems
102 // with text editors.
103 public static function provideGrammar() {
106 /* result */'וויקיפדיה',
107 /* word */'ויקיפדיה',
111 /* result */'וולפגנג',
113 /* case */'prefixed',
121 /* result */'־Wikipedia',
122 /* word */'Wikipedia',