Merge "Use local context to get messages and time formatting methods of Language...
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageMoTest.php
1 <?php
2 /**
3 * @author Santhosh Thottingal
4 * @copyright Copyright © 2012, Santhosh Thottingal
5 * @file
6 */
7
8 /** Tests for MediaWiki languages/classes/LanguageMo.php */
9 class LanguageMoTest extends MediaWikiTestCase {
10 private $lang;
11
12 function setUp() {
13 $this->lang = Language::factory( 'mo' );
14 }
15 function tearDown() {
16 unset( $this->lang );
17 }
18
19 /** @dataProvider providerPlural */
20 function testPlural( $result, $value ) {
21 $forms = array( 'one', 'few', 'other' );
22 $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
23 }
24
25 function providerPlural() {
26 return array (
27 array( 'few', 0 ),
28 array( 'one', 1 ),
29 array( 'few', 2 ),
30 array( 'few', 19 ),
31 array( 'other', 20 ),
32 array( 'other', 99 ),
33 array( 'other', 100 ),
34 array( 'few', 101 ),
35 array( 'few', 119 ),
36 array( 'other', 120 ),
37 array( 'other', 200 ),
38 array( 'few', 201 ),
39 array( 'few', 219 ),
40 array( 'other', 220 ),
41 );
42 }
43 }