Merge "(Bug 23472) Removed undesirable space after external link url in printout"
[lhc/web/wiklou.git] / tests / phpunit / languages / 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 /** @dataProvider providePlural */
11 function testPlural( $result, $value ) {
12 $forms = array( 'one', 'few', 'many' );
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( 'many', 0 ),
24 array( 'one', 1 ),
25 array( 'few', 2 ),
26 array( 'few', 3 ),
27 array( 'few', 4 ),
28 array( 'many', 5 ),
29 array( 'many', 9 ),
30 array( 'many', 10 ),
31 array( 'many', 11 ),
32 array( 'many', 21 ),
33 array( 'few', 22 ),
34 array( 'few', 23 ),
35 array( 'few', 24 ),
36 array( 'many', 25 ),
37 array( 'many', 200 ),
38 array( 'many', 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', 3 ),
54 array( 'other', 4 ),
55 array( 'other', 5 ),
56 array( 'other', 9 ),
57 array( 'other', 10 ),
58 array( 'other', 11 ),
59 array( 'other', 21 ),
60 array( 'other', 22 ),
61 array( 'other', 23 ),
62 array( 'other', 24 ),
63 array( 'other', 25 ),
64 array( 'other', 200 ),
65 array( 'other', 201 ),
66 );
67 }
68 }