MediaWiki REL1_33
LanguageHeTest.php
Go to the documentation of this file.
1<?php
22 // @todo the below test*PluralForms test methods can be refactored
23 // to use a single test method and data provider..
24
29 public function testTwoPluralForms( $result, $value ) {
30 $forms = [ 'one', 'other' ];
31 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
32 }
33
38 public function testThreePluralForms( $result, $value ) {
39 $forms = [ 'one', 'two', 'other' ];
40 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
41 }
42
47 public function testFourPluralForms( $result, $value ) {
48 $forms = [ 'one', 'two', 'many', 'other' ];
49 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
50 }
51
56 public function testGetPluralRuleType( $result, $value ) {
57 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
58 }
59
60 public static function provideTwoPluralForms() {
61 return [
62 [ 'other', 0 ], // Zero - plural
63 [ 'one', 1 ], // Singular
64 [ 'other', 2 ], // No third form provided, use it as plural
65 [ 'other', 3 ], // Plural - other
66 [ 'other', 10 ], // No fourth form provided, use it as plural
67 [ 'other', 20 ], // No fourth form provided, use it as plural
68 ];
69 }
70
71 public static function provideThreePluralForms() {
72 return [
73 [ 'other', 0 ], // Zero - plural
74 [ 'one', 1 ], // Singular
75 [ 'two', 2 ], // Dual
76 [ 'other', 3 ], // Plural - other
77 [ 'other', 10 ], // No fourth form provided, use it as plural
78 [ 'other', 20 ], // No fourth form provided, use it as plural
79 ];
80 }
81
82 public static function provideFourPluralForms() {
83 return [
84 [ 'other', 0 ], // Zero - plural
85 [ 'one', 1 ], // Singular
86 [ 'two', 2 ], // Dual
87 [ 'other', 3 ], // Plural - other
88 [ 'other', 10 ], // 10 is supposed to be plural (other), not "many"
89 [ 'many', 20 ], // Fourth form provided - rare, but supported by CLDR
90 ];
91 }
92
97 public function testGrammar( $result, $word, $case ) {
98 $this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) );
99 }
100
101 // The comments in the beginning of the line help avoid RTL problems
102 // with text editors.
103 public static function provideGrammar() {
104 return [
105 [
106 /* result */'וויקיפדיה',
107 /* word */'ויקיפדיה',
108 /* case */'תחילית',
109 ],
110 [
111 /* result */'וולפגנג',
112 /* word */'וולפגנג',
113 /* case */'prefixed',
114 ],
115 [
116 /* result */'קובץ',
117 /* word */'הקובץ',
118 /* case */'תחילית',
119 ],
120 [
121 /* result */'־Wikipedia',
122 /* word */'Wikipedia',
123 /* case */'תחילית',
124 ],
125 [
126 /* result */'־1995',
127 /* word */'1995',
128 /* case */'תחילית',
129 ],
130 ];
131 }
132}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Helping class to run tests using a clean language instance.
Tests for MediaWiki Hebrew grammar transformation handling.
static provideGrammar()
testFourPluralForms( $result, $value)
provideFourPluralForms Language::convertPlural
testThreePluralForms( $result, $value)
provideThreePluralForms Language::convertPlural
static provideFourPluralForms()
static provideTwoPluralForms()
testGrammar( $result, $word, $case)
provideGrammar Language::convertGrammar
testTwoPluralForms( $result, $value)
The most common usage for the plural forms is two forms, for singular and plural.
static provideThreePluralForms()
testGetPluralRuleType( $result, $value)
provideFourPluralForms Language::convertPlural