Merge "copy paste comment should probably have end instead of start"
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageMtTest.php
1 <?php
2 /**
3 * @author Amir E. Aharoni
4 * @copyright Copyright © 2012, Amir E. Aharoni
5 * @file
6 */
7
8 /** Tests for MediaWiki languages/classes/LanguageMt.php */
9 class LanguageMtTest extends LanguageClassesTestCase {
10 /** @dataProvider providePlural */
11 function testPlural( $result, $value ) {
12 $forms = array( 'one', 'few', 'many', 'other' );
13 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
14 }
15
16 /** @dataProvider providePlural */
17 function testGetPluralRuleType( $result, $value ) {
18 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
19 }
20
21 public static function providePlural() {
22 return array(
23 array( 'few', 0 ),
24 array( 'one', 1 ),
25 array( 'few', 2 ),
26 array( 'few', 10 ),
27 array( 'many', 11 ),
28 array( 'many', 19 ),
29 array( 'other', 20 ),
30 array( 'other', 99 ),
31 array( 'other', 100 ),
32 array( 'other', 101 ),
33 array( 'few', 102 ),
34 array( 'few', 110 ),
35 array( 'many', 111 ),
36 array( 'many', 119 ),
37 array( 'other', 120 ),
38 array( 'other', 201 ),
39 );
40 }
41
42 /** @dataProvider providerPluralTwoForms */
43 function testPluralTwoForms( $result, $value ) {
44 $forms = array( 'one', 'other' );
45 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
46 }
47
48 public static function providerPluralTwoForms() {
49 return array(
50 array( 'other', 0 ),
51 array( 'one', 1 ),
52 array( 'other', 2 ),
53 array( 'other', 10 ),
54 array( 'other', 11 ),
55 array( 'other', 19 ),
56 array( 'other', 20 ),
57 array( 'other', 99 ),
58 array( 'other', 100 ),
59 array( 'other', 101 ),
60 array( 'other', 102 ),
61 array( 'other', 110 ),
62 array( 'other', 111 ),
63 array( 'other', 119 ),
64 array( 'other', 120 ),
65 array( 'other', 201 ),
66 );
67 }
68 }