MediaWiki REL1_31
LanguageUkTest.php
Go to the documentation of this file.
1<?php
14 public function testPlural( $result, $value ) {
15 $forms = [ 'one', 'few', 'many', 'other' ];
16 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
17 }
18
23 public function testExplicitPlural() {
24 $forms = [ 'one', 'few', 'many', 'other', '12=dozen' ];
25 $this->assertEquals( 'dozen', $this->getLang()->convertPlural( 12, $forms ) );
26 $forms = [ 'one', 'few', 'many', '100=hundred', 'other', '12=dozen' ];
27 $this->assertEquals( 'hundred', $this->getLang()->convertPlural( 100, $forms ) );
28 }
29
34 public function testGetPluralRuleType( $result, $value ) {
35 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
36 }
37
38 public static function providePlural() {
39 return [
40 [ 'one', 1 ],
41 [ 'many', 11 ],
42 [ 'one', 91 ],
43 [ 'one', 121 ],
44 [ 'few', 2 ],
45 [ 'few', 3 ],
46 [ 'few', 4 ],
47 [ 'few', 334 ],
48 [ 'many', 5 ],
49 [ 'many', 15 ],
50 [ 'many', 120 ],
51 ];
52 }
53
58 public function testPluralTwoForms( $result, $value ) {
59 $forms = [ '1=one', 'other' ];
60 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
61 }
62
63 public static function providePluralTwoForms() {
64 return [
65 [ 'one', 1 ],
66 [ 'other', 11 ],
67 [ 'other', 91 ],
68 [ 'other', 121 ],
69 ];
70 }
71
76 public function testGrammar( $result, $word, $case ) {
77 $this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) );
78 }
79
80 public static function providerGrammar() {
81 return [
82 [
83 'Вікіпедії',
84 'Вікіпедія',
85 'genitive',
86 ],
87 [
88 'Віківидів',
89 'Віківиди',
90 'genitive',
91 ],
92 [
93 'Вікіцитат',
94 'Вікіцитати',
95 'genitive',
96 ],
97 [
98 'Вікіпідручника',
99 'Вікіпідручник',
100 'genitive',
101 ],
102 [
103 'Вікіпедію',
104 'Вікіпедія',
105 'accusative',
106 ],
107 ];
108 }
109}
Helping class to run tests using a clean language instance.
testPluralTwoForms( $result, $value)
providePluralTwoForms Language::convertPlural
testGrammar( $result, $word, $case)
providerGrammar Language::convertGrammar
testPlural( $result, $value)
providePlural Language::convertPlural
testExplicitPlural()
Test explicit plural forms - n=FormN forms Language::convertPlural.
static providerGrammar()
static providePluralTwoForms()
testGetPluralRuleType( $result, $value)
providePlural Language::getPluralRuleType
static providePlural()