Merge "Added a PoolCounterWorkViaCallback convenience class."
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageLtTest.php
1 <?php
2 /**
3 * @author Santhosh Thottingal
4 * @copyright Copyright © 2012, Santhosh Thottingal
5 * @file
6 */
7
8 /** Tests for MediaWiki languages/LanguageLt.php */
9 class LanguageLtTest extends LanguageClassesTestCase {
10 /** @dataProvider providePlural */
11 function testPlural( $result, $value ) {
12 $forms = array( 'one', 'few', '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 function providePlural() {
22 return array (
23 array( 'other', 0 ),
24 array( 'one', 1 ),
25 array( 'few', 2 ),
26 array( 'few', 9 ),
27 array( 'other', 10 ),
28 array( 'other', 11 ),
29 array( 'other', 20 ),
30 array( 'one', 21 ),
31 array( 'few', 32 ),
32 array( 'one', 41 ),
33 array( 'one', 40001 ),
34 );
35 }
36
37 /** @dataProvider providePluralTwoForms */
38 function testOneFewPlural( $result, $value ) {
39 $forms = array( 'one', 'other' );
40 // This fails for 21, but not sure why.
41 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
42 }
43
44 function providePluralTwoForms() {
45 return array (
46 array( 'one', 1 ),
47 array( 'other', 2 ),
48 array( 'other', 15 ),
49 array( 'other', 20 ),
50 array( 'one', 21 ),
51 array( 'other', 22 ),
52 );
53 }
54 }