aa8c28a020c59c5e66be89044f374c0d0abe7e90
[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 function testBeTaraskTestsUsesBeTaraskCode() {
10 $this->assertEquals( 'be-tarask',
11 $this->getLang()->getCode()
12 );
13 }
14
15 /** see bug 23156 & r64981 */
16 function testSearchRightSingleQuotationMarkAsApostroph() {
17 $this->assertEquals(
18 "'",
19 $this->getLang()->normalizeForSearch( '’' ),
20 'bug 23156: U+2019 conversion to U+0027'
21 );
22 }
23
24 /** see bug 23156 & r64981 */
25 function testCommafy() {
26 $this->assertEquals( '1,234,567', $this->getLang()->commafy( '1234567' ) );
27 $this->assertEquals( '12,345', $this->getLang()->commafy( '12345' ) );
28 }
29
30 /** see bug 23156 & r64981 */
31 function testDoesNotCommafyFourDigitsNumber() {
32 $this->assertEquals( '1234', $this->getLang()->commafy( '1234' ) );
33 }
34
35 /** @dataProvider providePlural */
36 function testPlural( $result, $value ) {
37 $forms = array( 'one', 'few', 'many', 'other' );
38 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
39 }
40
41 /** @dataProvider providePlural */
42 function testGetPluralRuleType( $result, $value ) {
43 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
44 }
45
46 function providePlural() {
47 return array (
48 array( 'one', 1 ),
49 array( 'many', 11 ),
50 array( 'one', 91 ),
51 array( 'one', 121 ),
52 array( 'few', 2 ),
53 array( 'few', 3 ),
54 array( 'few', 4 ),
55 array( 'few', 334 ),
56 array( 'many', 5 ),
57 array( 'many', 15 ),
58 array( 'many', 120 ),
59 );
60 }
61
62 /** @dataProvider providePluralTwoForms */
63 function testPluralTwoForms( $result, $value ) {
64 $forms = array( 'one', 'other' );
65 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
66 }
67
68 function providePluralTwoForms() {
69 return array(
70 array( 'one', 1 ),
71 array( 'other', 11 ),
72 array( 'other', 91 ),
73 array( 'other', 121 ),
74 );
75 }
76 }