96d2bc92aff578fc605cd99823373e0a124cb811
[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 /**
11 * @dataProvider providePlural
12 * @covers Language::convertPlural
13 */
14 public function testPlural( $result, $value ) {
15 $forms = array( 'one', 'few', 'many', 'other' );
16 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
17 }
18
19 /**
20 * @dataProvider providePlural
21 * @covers Language::getPluralRuleType
22 */
23 public function testGetPluralRuleType( $result, $value ) {
24 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
25 }
26
27 public static function providePlural() {
28 return array(
29 array( 'few', 0 ),
30 array( 'one', 1 ),
31 array( 'few', 2 ),
32 array( 'few', 10 ),
33 array( 'many', 11 ),
34 array( 'many', 19 ),
35 array( 'other', 20 ),
36 array( 'other', 99 ),
37 array( 'other', 100 ),
38 array( 'other', 101 ),
39 array( 'few', 102 ),
40 array( 'few', 110 ),
41 array( 'many', 111 ),
42 array( 'many', 119 ),
43 array( 'other', 120 ),
44 array( 'other', 201 ),
45 );
46 }
47
48 /**
49 * @dataProvider providePluralTwoForms
50 * @covers Language::convertPlural
51 */
52 public function testPluralTwoForms( $result, $value ) {
53 $forms = array( 'one', 'other' );
54 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
55 }
56
57 public static function providePluralTwoForms() {
58 return array(
59 array( 'other', 0 ),
60 array( 'one', 1 ),
61 array( 'other', 2 ),
62 array( 'other', 10 ),
63 array( 'other', 11 ),
64 array( 'other', 19 ),
65 array( 'other', 20 ),
66 array( 'other', 99 ),
67 array( 'other', 100 ),
68 array( 'other', 101 ),
69 array( 'other', 102 ),
70 array( 'other', 110 ),
71 array( 'other', 111 ),
72 array( 'other', 119 ),
73 array( 'other', 120 ),
74 array( 'other', 201 ),
75 );
76 }
77 }