X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=tests%2Fphpunit%2Flanguages%2Fclasses%2FLanguageArTest.php;h=c7ff3bb9722ce99231219e8bc68e056592875b48;hb=c6ad2554f40f8ebbe9e38ac64ea933076f348729;hp=f3f5a3f1f1bd34685157689779e9ad1cda549697;hpb=f1189284588d626e257bb8cfa43e7a8d60c0453f;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/languages/classes/LanguageArTest.php b/tests/phpunit/languages/classes/LanguageArTest.php index f3f5a3f1f1..c7ff3bb972 100644 --- a/tests/phpunit/languages/classes/LanguageArTest.php +++ b/tests/phpunit/languages/classes/LanguageArTest.php @@ -1,32 +1,62 @@ assertEquals( '١٬٢٣٤٬٥٦٧', $this->getLang()->formatNum( '1234567' ) ); - $this->assertEquals( '-١٢٫٨٩', $this->getLang()->formatNum( -12.89 ) ); + public function testFormatNum( $num, $formatted ) { + $this->assertEquals( $formatted, $this->getLang()->formatNum( $num ) ); + } + + public static function provideFormatNum() { + return [ + [ '1234567', '١٬٢٣٤٬٥٦٧' ], + [ -12.89, '-١٢٫٨٩' ], + ]; + } + + /** + * @covers LanguageAr::normalize + * @covers Language::normalize + * @dataProvider provideNormalize + */ + public function testNormalize( $input, $expected ) { + if ( $input === $expected ) { + throw new Exception( 'Expected output must differ.' ); + } + + $this->setMwGlobals( 'wgFixArabicUnicode', true ); + $this->assertSame( $expected, $this->getLang()->normalize( $input ), 'ar-normalised form' ); + + $this->setMwGlobals( 'wgFixArabicUnicode', false ); + $this->hideDeprecated( '$wgFixArabicUnicode = false' ); + $this->assertSame( $input, $this->getLang()->normalize( $input ), 'regular normalised form' ); + } + + public static function provideNormalize() { + return [ + [ + 'ﷅ', + 'صمم', + ], + ]; } /** * Mostly to test the raw ascii feature. - * @dataProvider providerSprintfDate + * @dataProvider provideSprintfDate * @covers Language::sprintfDate */ public function testSprintfDate( $format, $date, $expected ) { $this->assertEquals( $expected, $this->getLang()->sprintfDate( $format, $date ) ); } - public static function providerSprintfDate() { + public static function provideSprintfDate() { return [ [ 'xg "vs" g',