Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / languages / classes / LanguageArTest.php
blob5a66759873f29e7a4051137648fd1b88da4ae1b4
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 [
30 'xg "vs" g',
31 '20120102030410',
32 'يناير vs ٣'
35 'xmY',
36 '20120102030410',
37 '١٤٣٣'
40 'xnxmY',
41 '20120102030410',
42 '1433'
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 = [ '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 [
71 [ 'zero', 0 ],
72 [ 'one', 1 ],
73 [ 'two', 2 ],
74 [ 'few', 3 ],
75 [ 'few', 9 ],
76 [ 'few', 110 ],
77 [ 'many', 11 ],
78 [ 'many', 15 ],
79 [ 'many', 99 ],
80 [ 'many', 9999 ],
81 [ 'other', 100 ],
82 [ 'other', 102 ],
83 [ 'other', 1000 ],
84 [ 'other', 1.7 ],