Merge "(bug 35993) API gettoken parameter is deprecated (release notes complement)"
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageArTest.php
1 <?php
2 /**
3 * Based on LanguagMlTest
4 * @file
5 */
6
7 /** Tests for MediaWiki languages/LanguageAr.php */
8 class LanguageArTest extends LanguageClassesTestCase {
9
10 function testFormatNum() {
11 $this->assertEquals( '١٬٢٣٤٬٥٦٧', $this->getLang()->formatNum( '1234567' ) );
12 $this->assertEquals( '-١٢٫٨٩', $this->getLang()->formatNum( -12.89 ) );
13 }
14
15 /**
16 * Mostly to test the raw ascii feature.
17 * @dataProvider providerSprintfDate
18 */
19 function testSprintfDate( $format, $date, $expected ) {
20 $this->assertEquals( $expected, $this->getLang()->sprintfDate( $format, $date ) );
21 }
22
23 function providerSprintfDate() {
24 return array(
25 array(
26 'xg "vs" g',
27 '20120102030410',
28 'يناير vs ٣'
29 ),
30 array(
31 'xmY',
32 '20120102030410',
33 '١٤٣٣'
34 ),
35 array(
36 'xnxmY',
37 '20120102030410',
38 '1433'
39 ),
40 array(
41 'xN xmj xmn xN xmY',
42 '20120102030410',
43 ' 7 2 ١٤٣٣'
44 ),
45 );
46 }
47
48 /** @dataProvider providePlural */
49 function testPlural( $result, $value ) {
50 $forms = array( 'zero', 'one', 'two', 'few', 'many', 'other' );
51 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
52 }
53
54 function providePlural() {
55 return array(
56 array( 'zero', 0 ),
57 array( 'one', 1 ),
58 array( 'two', 2 ),
59 array( 'few', 3 ),
60 array( 'few', 9 ),
61 array( 'few', 110 ),
62 array( 'many', 11 ),
63 array( 'many', 15 ),
64 array( 'many', 99 ),
65 array( 'many', 9999 ),
66 array( 'other', 100 ),
67 array( 'other', 102 ),
68 array( 'other', 1000 ),
69 array( 'other', 1.7 ),
70 );
71 }
72 }