Merge "Add semantic tags to license info text"
[lhc/web/wiklou.git] / tests / phpunit / languages / classes / LanguageBe_taraskTest.php
1 <?php
2
3 // phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
4 /**
5 * @covers LanguageBe_tarask
6 */
7 class LanguageBe_taraskTest extends LanguageClassesTestCase {
8 // phpcs:enable
9 /**
10 * Make sure the language code we are given is indeed
11 * be-tarask. This is to ensure LanguageClassesTestCase
12 * does not give us the wrong language.
13 */
14 public function testBeTaraskTestsUsesBeTaraskCode() {
15 $this->assertEquals( 'be-tarask',
16 $this->getLang()->getCode()
17 );
18 }
19
20 /**
21 * @see T25156 & r64981
22 * @covers Language::commafy
23 */
24 public function testSearchRightSingleQuotationMarkAsApostroph() {
25 $this->assertEquals(
26 "'",
27 $this->getLang()->normalizeForSearch( '’' ),
28 'T25156: U+2019 conversion to U+0027'
29 );
30 }
31
32 /**
33 * @see T25156 & r64981
34 * @covers Language::commafy
35 */
36 public function testCommafy() {
37 $this->assertEquals( '1,234,567', $this->getLang()->commafy( '1234567' ) );
38 $this->assertEquals( '12,345', $this->getLang()->commafy( '12345' ) );
39 }
40
41 /**
42 * @see T25156 & r64981
43 * @covers Language::commafy
44 */
45 public function testDoesNotCommafyFourDigitsNumber() {
46 $this->assertEquals( '1234', $this->getLang()->commafy( '1234' ) );
47 }
48
49 /**
50 * @dataProvider providePlural
51 * @covers Language::convertPlural
52 */
53 public function testPlural( $result, $value ) {
54 $forms = [ 'one', 'few', 'many', 'other' ];
55 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
56 }
57
58 /**
59 * @dataProvider providePlural
60 * @covers Language::getPluralRuleType
61 */
62 public function testGetPluralRuleType( $result, $value ) {
63 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
64 }
65
66 public static function providePlural() {
67 return [
68 [ 'one', 1 ],
69 [ 'many', 11 ],
70 [ 'one', 91 ],
71 [ 'one', 121 ],
72 [ 'few', 2 ],
73 [ 'few', 3 ],
74 [ 'few', 4 ],
75 [ 'few', 334 ],
76 [ 'many', 5 ],
77 [ 'many', 15 ],
78 [ 'many', 120 ],
79 ];
80 }
81
82 /**
83 * @dataProvider providePluralTwoForms
84 * @covers Language::convertPlural
85 */
86 public function testPluralTwoForms( $result, $value ) {
87 $forms = [ '1=one', 'other' ];
88 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
89 }
90
91 public static function providePluralTwoForms() {
92 return [
93 [ 'other', 0 ],
94 [ 'one', 1 ],
95 [ 'other', 11 ],
96 [ 'other', 91 ],
97 [ 'other', 121 ],
98 ];
99 }
100 }