More complete, more straightforward JobQueueMemoryTest
[mediawiki.git] / tests / phpunit / languages / classes / LanguageArTest.php
blob7b48f236a88315aed9d4328d997e59c26ef1ffbe
1 <?php
2 /**
3 * Based on LanguagMlTest
4 * @file
5 */
7 /** Tests for MediaWiki languages/LanguageAr.php */
8 class LanguageArTest extends LanguageClassesTestCase {
9 /**
10 * @covers Language::formatNum
11 * @todo split into a test and a dataprovider
13 public function testFormatNum() {
14 $this->assertEquals( '١٬٢٣٤٬٥٦٧', $this->getLang()->formatNum( '1234567' ) );
15 $this->assertEquals( '-١٢٫٨٩', $this->getLang()->formatNum( -12.89 ) );
18 /**
19 * Mostly to test the raw ascii feature.
20 * @dataProvider providerSprintfDate
21 * @covers Language::sprintfDate
23 public function testSprintfDate( $format, $date, $expected ) {
24 $this->assertEquals( $expected, $this->getLang()->sprintfDate( $format, $date ) );
27 public static function providerSprintfDate() {
28 return array(
29 array(
30 'xg "vs" g',
31 '20120102030410',
32 'يناير vs ٣'
34 array(
35 'xmY',
36 '20120102030410',
37 '١٤٣٣'
39 array(
40 'xnxmY',
41 '20120102030410',
42 '1433'
44 array(
45 'xN xmj xmn xN xmY',
46 '20120102030410',
47 ' 7 2 ١٤٣٣'
52 /**
53 * @dataProvider providePlural
54 * @covers Language::convertPlural
56 public function testPlural( $result, $value ) {
57 $forms = array( 'zero', 'one', 'two', 'few', 'many', 'other' );
58 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
61 /**
62 * @dataProvider providePlural
63 * @covers Language::getPluralRuleType
65 public function testGetPluralRuleType( $result, $value ) {
66 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
69 public static function providePlural() {
70 return array(
71 array( 'zero', 0 ),
72 array( 'one', 1 ),
73 array( 'two', 2 ),
74 array( 'few', 3 ),
75 array( 'few', 9 ),
76 array( 'few', 110 ),
77 array( 'many', 11 ),
78 array( 'many', 15 ),
79 array( 'many', 99 ),
80 array( 'many', 9999 ),
81 array( 'other', 100 ),
82 array( 'other', 102 ),
83 array( 'other', 1000 ),
84 array( 'other', 1.7 ),