Debian Codegraph @

tests/phpunit/includes/languages/LanguageMlTest.php

raw symbols SCIP
1 <?php
2 /**
3 * @author Santhosh Thottingal
4 * @copyright Copyright © 2011, Santhosh Thottingal
5 * @file
6 */
7
8 /**
9 * @group Language
10 * @covers \LanguageMl
11 */
12 class LanguageMlTest extends LanguageClassesTestCase {
13
14 /**
15 * @dataProvider provideFormatNum
16 * @covers \MediaWiki\Language\Language::formatNum
17 */
18 public function testFormatNum( $value, $result ) {
19 // For T31495
20 $this->assertEquals( $result, $this->getLang()->formatNum( $value ) );
21 }
22
23 public static function provideFormatNum() {
24 return [
25 [ '1234567', '12,34,567' ],
26 [ '12345', '12,345' ],
27 [ '1', '1' ],
28 [ '123', '123' ],
29 [ '1234', '1,234' ],
30 [ '12345.56', '12,345.56' ],
31 [ '12345679812345678', '12,34,56,79,81,23,45,678' ],
32 [ '.12345', '.12345' ],
33 [ '-1200000', '−12,00,000' ],
34 [ '-98', '−98' ],
35 [ -98, '−98' ],
36 [ -12345678, '−1,23,45,678' ],
37 [ '', '' ],
38 [ null, '' ],
39 ];
40 }
41
42 /**
43 * @covers \LanguageMl::normalize
44 * @covers \MediaWiki\Language\Language::normalize
45 * @dataProvider provideNormalize
46 */
47 public function testNormalize( $input, $expected ) {
48 if ( $input === $expected ) {
49 $this->fail( 'Expected output must differ.' );
50 }
51
52 $this->assertSame(
53 $expected,
54 $this->getLang()->normalize( $input ),
55 'ml-normalised form'
56 );
57 }
58
59 public static function provideNormalize() {
60 return [
61 [
62 'ല്‍',
63 'ൽ',
64 ],
65 [
66 'ര്‍',
67 'ർ',
68 ],
69 [
70 'ള്‍',
71 'ൾ',
72 ],
73 ];
74 }
75 }