Deprecate $wgFixArabicUnicode / $wgFixMalayalamUnicode
[lhc/web/wiklou.git] / tests / phpunit / languages / classes / LanguageMlTest.php
1 <?php
2 /**
3 * @author Santhosh Thottingal
4 * @copyright Copyright © 2011, Santhosh Thottingal
5 * @file
6 */
7
8 /**
9 * @covers LanguageMl
10 */
11 class LanguageMlTest extends LanguageClassesTestCase {
12
13 /**
14 * @dataProvider provideFormatNum
15 * @covers Language::formatNum
16 */
17 public function testFormatNum( $result, $value ) {
18 // For T31495
19 $this->assertEquals( $result, $this->getLang()->formatNum( $value ) );
20 }
21
22 public static function provideFormatNum() {
23 return [
24 [ '12,34,567', '1234567' ],
25 [ '12,345', '12345' ],
26 [ '1', '1' ],
27 [ '123', '123' ],
28 [ '1,234', '1234' ],
29 [ '12,345.56', '12345.56' ],
30 [ '12,34,56,79,81,23,45,678', '12345679812345678' ],
31 [ '.12345', '.12345' ],
32 [ '-12,00,000', '-1200000' ],
33 [ '-98', '-98' ],
34 [ '-98', -98 ],
35 [ '-1,23,45,678', -12345678 ],
36 [ '', '' ],
37 [ '', null ],
38 ];
39 }
40
41 /**
42 * @covers LanguageMl::normalize
43 * @covers Language::normalize
44 * @dataProvider provideNormalize
45 */
46 public function testNormalize( $input, $expected ) {
47 if ( $input === $expected ) {
48 throw new Exception( 'Expected output must differ.' );
49 }
50
51 $this->setMwGlobals( 'wgFixMalayalamUnicode', true );
52 $this->assertSame( $expected, $this->getLang()->normalize( $input ), 'ml-normalised form' );
53
54 $this->setMwGlobals( 'wgFixMalayalamUnicode', false );
55 $this->hideDeprecated( '$wgFixMalayalamUnicode = false' );
56 $this->assertSame( $input, $this->getLang()->normalize( $input ), 'regular normalised form' );
57 }
58
59 public static function provideNormalize() {
60 return [
61 [
62 'ല്‍',
63 'ൽ',
64 ],
65 ];
66 }
67 }