Merge "Allow API results to wrap long lines"
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageBe_taraskTest.php
1 <?php
2
3 class LanguageBe_taraskTest extends LanguageClassesTestCase {
4
5 /**
6 * Make sure the language code we are given is indeed
7 * be-tarask. This is to ensure LanguageClassesTestCase
8 * does not give us the wrong language.
9 */
10 function testBeTaraskTestsUsesBeTaraskCode() {
11 $this->assertEquals( 'be-tarask',
12 $this->getLang()->getCode()
13 );
14 }
15
16 /** see bug 23156 & r64981 */
17 function testSearchRightSingleQuotationMarkAsApostroph() {
18 $this->assertEquals(
19 "'",
20 $this->getLang()->normalizeForSearch( '’' ),
21 'bug 23156: U+2019 conversion to U+0027'
22 );
23 }
24
25 /** see bug 23156 & r64981 */
26 function testCommafy() {
27 $this->assertEquals( '1,234,567', $this->getLang()->commafy( '1234567' ) );
28 $this->assertEquals( '12,345', $this->getLang()->commafy( '12345' ) );
29 }
30
31 /** see bug 23156 & r64981 */
32 function testDoesNotCommafyFourDigitsNumber() {
33 $this->assertEquals( '1234', $this->getLang()->commafy( '1234' ) );
34 }
35
36 /** @dataProvider providePluralFourForms */
37 function testPluralFourForms( $result, $value ) {
38 $forms = array( 'one', 'few', 'many', 'other' );
39 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
40 }
41
42 function providePluralFourForms() {
43 return array(
44 array( 'one', 1 ),
45 array( 'many', 11 ),
46 array( 'one', 91 ),
47 array( 'one', 121 ),
48 array( 'few', 2 ),
49 array( 'few', 3 ),
50 array( 'few', 4 ),
51 array( 'few', 334 ),
52 array( 'many', 5 ),
53 array( 'many', 15 ),
54 array( 'many', 120 ),
55 );
56 }
57
58 /** @dataProvider providePluralTwoForms */
59 function testPluralTwoForms( $result, $value ) {
60 $forms = array( 'one', 'several' );
61 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
62 }
63
64 function providePluralTwoForms() {
65 return array(
66 array( 'one', 1 ),
67 array( 'several', 11 ),
68 array( 'several', 91 ),
69 array( 'several', 121 ),
70 );
71 }
72
73 }