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->hideDeprecated( '$wgFixArabicUnicode = false' );
38 $this->assertSame( $input, $this->getLang()->normalize( $input ), 'regular normalised form' );
41 public static function provideNormalize() {
51 * Mostly to test the raw ascii feature.
52 * @dataProvider provideSprintfDate
53 * @covers Language::sprintfDate
55 public function testSprintfDate( $format, $date, $expected ) {
56 $this->assertEquals( $expected, $this->getLang()->sprintfDate( $format, $date ) );
59 public static function provideSprintfDate() {
85 * @dataProvider providePlural
86 * @covers Language::convertPlural
88 public function testPlural( $result, $value ) {
89 $forms = [ 'zero', 'one', 'two', 'few', 'many', 'other' ];
90 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
94 * @dataProvider providePlural
95 * @covers Language::getPluralRuleType
97 public function testGetPluralRuleType( $result, $value ) {
98 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
101 public static function providePlural() {