MediaWiki REL1_32
LanguageMlTest.php
Go to the documentation of this file.
1<?php
12
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
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->assertSame( $input, $this->getLang()->normalize( $input ), 'regular normalised form' );
56 }
57
58 public static function provideNormalize() {
59 return [
60 [
61 'ല്‍',
62 'ൽ',
63 ],
64 ];
65 }
66}
Helping class to run tests using a clean language instance.
static provideFormatNum()
static provideNormalize()
testFormatNum( $result, $value)
provideFormatNum Language::formatNum
testNormalize( $input, $expected)
LanguageMl::normalize Language::normalize provideNormalize.
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
if(is_array($mode)) switch( $mode) $input