MediaWiki REL1_31
LanguageArTest.php
Go to the documentation of this file.
1<?php
15 public function testFormatNum() {
16 $this->assertEquals( '١٬٢٣٤٬٥٦٧', $this->getLang()->formatNum( '1234567' ) );
17 $this->assertEquals( '-١٢٫٨٩', $this->getLang()->formatNum( -12.89 ) );
18 }
19
25 public function testSprintfDate( $format, $date, $expected ) {
26 $this->assertEquals( $expected, $this->getLang()->sprintfDate( $format, $date ) );
27 }
28
29 public static function providerSprintfDate() {
30 return [
31 [
32 'xg "vs" g',
33 '20120102030410',
34 'يناير vs ٣'
35 ],
36 [
37 'xmY',
38 '20120102030410',
39 '١٤٣٣'
40 ],
41 [
42 'xnxmY',
43 '20120102030410',
44 '1433'
45 ],
46 [
47 'xN xmj xmn xN xmY',
48 '20120102030410',
49 ' 7 2 ١٤٣٣'
50 ],
51 ];
52 }
53
58 public function testPlural( $result, $value ) {
59 $forms = [ 'zero', 'one', 'two', 'few', 'many', 'other' ];
60 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
61 }
62
67 public function testGetPluralRuleType( $result, $value ) {
68 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
69 }
70
71 public static function providePlural() {
72 return [
73 [ 'zero', 0 ],
74 [ 'one', 1 ],
75 [ 'two', 2 ],
76 [ 'few', 3 ],
77 [ 'few', 9 ],
78 [ 'few', 110 ],
79 [ 'many', 11 ],
80 [ 'many', 15 ],
81 [ 'many', 99 ],
82 [ 'many', 9999 ],
83 [ 'other', 100 ],
84 [ 'other', 102 ],
85 [ 'other', 1000 ],
86 [ 'other', 1.7 ],
87 ];
88 }
89}
testFormatNum()
Language::formatNum.
static providerSprintfDate()
testPlural( $result, $value)
providePlural Language::convertPlural
testSprintfDate( $format, $date, $expected)
Mostly to test the raw ascii feature.
static providePlural()
testGetPluralRuleType( $result, $value)
providePlural Language::getPluralRuleType
Helping class to run tests using a clean language instance.