MediaWiki REL1_30
LanguageRuTest.php
Go to the documentation of this file.
1<?php
15 public function testPlural( $result, $value ) {
16 $forms = [ 'one', 'few', 'many', 'other' ];
17 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
18 }
19
24 public function testExplicitPlural() {
25 $forms = [ 'one', 'few', 'many', 'other', '12=dozen' ];
26 $this->assertEquals( 'dozen', $this->getLang()->convertPlural( 12, $forms ) );
27 $forms = [ 'one', 'few', 'many', '100=hundred', 'other', '12=dozen' ];
28 $this->assertEquals( 'hundred', $this->getLang()->convertPlural( 100, $forms ) );
29 }
30
35 public function testGetPluralRuleType( $result, $value ) {
36 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
37 }
38
39 public static function providePlural() {
40 return [
41 [ 'one', 1 ],
42 [ 'many', 11 ],
43 [ 'one', 91 ],
44 [ 'one', 121 ],
45 [ 'few', 2 ],
46 [ 'few', 3 ],
47 [ 'few', 4 ],
48 [ 'few', 334 ],
49 [ 'many', 5 ],
50 [ 'many', 15 ],
51 [ 'many', 120 ],
52 ];
53 }
54
59 public function testPluralTwoForms( $result, $value ) {
60 $forms = [ '1=one', 'other' ];
61 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
62 }
63
64 public static function providePluralTwoForms() {
65 return [
66 [ 'one', 1 ],
67 [ 'other', 11 ],
68 [ 'other', 91 ],
69 [ 'other', 121 ],
70 ];
71 }
72
77 public function testGrammar( $result, $word, $case ) {
78 $this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) );
79 }
80
81 public static function providerGrammar() {
82 return [
83 [
84 'Википедии',
85 'Википедия',
86 'genitive',
87 ],
88 [
89 'Викитеки',
90 'Викитека',
91 'genitive',
92 ],
93 [
94 'Викитеке',
95 'Викитека',
96 'prepositional',
97 ],
98 [
99 'Викисклада',
100 'Викисклад',
101 'genitive',
102 ],
103 [
104 'Викискладе',
105 'Викисклад',
106 'prepositional',
107 ],
108 [
109 'Викиданных',
110 'Викиданные',
111 'prepositional',
112 ],
113 [
114 'русского',
115 'русский',
116 'languagegen',
117 ],
118 [
119 'немецкого',
120 'немецкий',
121 'languagegen',
122 ],
123 [
124 'иврита',
125 'иврит',
126 'languagegen',
127 ],
128 [
129 'эсперанто',
130 'эсперанто',
131 'languagegen',
132 ],
133 [
134 'русском',
135 'русский',
136 'languageprep',
137 ],
138 [
139 'немецком',
140 'немецкий',
141 'languageprep',
142 ],
143 [
144 'идише',
145 'идиш',
146 'languageprep',
147 ],
148 [
149 'эсперанто',
150 'эсперанто',
151 'languageprep',
152 ],
153 [
154 'по-русски',
155 'русский',
156 'languageadverb',
157 ],
158 [
159 'по-немецки',
160 'немецкий',
161 'languageadverb',
162 ],
163 [
164 'на иврите',
165 'иврит',
166 'languageadverb',
167 ],
168 [
169 'на эсперанто',
170 'эсперанто',
171 'languageadverb',
172 ],
173 [
174 'на языке гуарани',
175 'гуарани',
176 'languageadverb',
177 ],
178 ];
179 }
180}
Helping class to run tests using a clean language instance.
Tests for MediaWiki languages/classes/LanguageRu.php.
static providePlural()
testGetPluralRuleType( $result, $value)
providePlural Language::getPluralRuleType
testPluralTwoForms( $result, $value)
providePluralTwoForms Language::convertPlural
static providerGrammar()
testPlural( $result, $value)
providePlural Language::convertPlural
testExplicitPlural()
Test explicit plural forms - n=FormN forms Language::convertPlural.
testGrammar( $result, $word, $case)
providerGrammar Language::convertGrammar
static providePluralTwoForms()