Follow-up r107806 - More extensive tests for Language::sprintfDate. Including test...
[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 MediaWikiTestCase {
9 private $lang;
10
11 function setUp() {
12 $this->lang = Language::factory( 'Ar' );
13 }
14 function tearDown() {
15 unset( $this->lang );
16 }
17
18 function testFormatNum() {
19 $this->assertEquals( '١٬٢٣٤٬٥٦٧', $this->lang->formatNum( '1234567' ) );
20 $this->assertEquals( '-١٢٫٨٩', $this->lang->formatNum( -12.89 ) );
21 }
22
23 /**
24 * Mostly to test the raw ascii feature.
25 * @dataProvider providerSprintfDate
26 */
27 function testSprintfDate( $format, $date, $expected ) {
28 $this->assertEquals( $expected, $this->lang->sprintfDate( $format, $date ) );
29 }
30
31 function providerSprintfDate() {
32 return array(
33 array(
34 'xg "vs" g',
35 '20120102030410',
36 'يناير vs ٣'
37 ),
38 array(
39 'xmY',
40 '20120102030410',
41 '١٤٣٣'
42 ),
43 array(
44 'xnxmY',
45 '20120102030410',
46 '1433'
47 ),
48 array(
49 'xN xmj xmn xN xmY',
50 '20120102030410',
51 ' 7 2 ١٤٣٣'
52 ),
53 );
54 }
55 }