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