Merge "Import: Fix error reporting"
[lhc/web/wiklou.git] / tests / phpunit / languages / classes / LanguagePlTest.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/LanguagePl.php */
9 class LanguagePlTest extends LanguageClassesTestCase {
10 /**
11 * @dataProvider providePlural
12 * @covers Language::convertPlural
13 */
14 public function testPlural( $result, $value ) {
15 $forms = array( 'one', 'few', 'many' );
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( 'many', 0 ),
30 array( 'one', 1 ),
31 array( 'few', 2 ),
32 array( 'few', 3 ),
33 array( 'few', 4 ),
34 array( 'many', 5 ),
35 array( 'many', 9 ),
36 array( 'many', 10 ),
37 array( 'many', 11 ),
38 array( 'many', 21 ),
39 array( 'few', 22 ),
40 array( 'few', 23 ),
41 array( 'few', 24 ),
42 array( 'many', 25 ),
43 array( 'many', 200 ),
44 array( 'many', 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', 3 ),
63 array( 'other', 4 ),
64 array( 'other', 5 ),
65 array( 'other', 9 ),
66 array( 'other', 10 ),
67 array( 'other', 11 ),
68 array( 'other', 21 ),
69 array( 'other', 22 ),
70 array( 'other', 23 ),
71 array( 'other', 24 ),
72 array( 'other', 25 ),
73 array( 'other', 200 ),
74 array( 'other', 201 ),
75 );
76 }
77 }