6 class LanguageArTest
extends LanguageClassesTestCase
{
9 * @covers Language::formatNum
10 * @dataProvider provideFormatNum
12 public function testFormatNum( $num, $formatted ) {
13 $this->assertEquals( $formatted, $this->getLang()->formatNum( $num ) );
16 public static function provideFormatNum() {
18 [ '1234567', '١٬٢٣٤٬٥٦٧' ],
24 * @covers LanguageAr::normalize
25 * @covers Language::normalize
26 * @dataProvider provideNormalize
28 public function testNormalize( $input, $expected ) {
29 if ( $input === $expected ) {
30 throw new Exception( 'Expected output must differ.' );
33 $this->setMwGlobals( 'wgFixArabicUnicode', true );
34 $this->assertSame( $expected, $this->getLang()->normalize( $input ), 'ar-normalised form' );
36 $this->setMwGlobals( 'wgFixArabicUnicode', false );
37 $this->assertSame( $input, $this->getLang()->normalize( $input ), 'regular normalised form' );
40 public static function provideNormalize() {
50 * Mostly to test the raw ascii feature.
51 * @dataProvider provideSprintfDate
52 * @covers Language::sprintfDate
54 public function testSprintfDate( $format, $date, $expected ) {
55 $this->assertEquals( $expected, $this->getLang()->sprintfDate( $format, $date ) );
58 public static function provideSprintfDate() {
84 * @dataProvider providePlural
85 * @covers Language::convertPlural
87 public function testPlural( $result, $value ) {
88 $forms = [ 'zero', 'one', 'two', 'few', 'many', 'other' ];
89 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
93 * @dataProvider providePlural
94 * @covers Language::getPluralRuleType
96 public function testGetPluralRuleType( $result, $value ) {
97 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
100 public static function providePlural() {