Follow up r102802. Bug 32359
authorSanthosh Thottingal <santhosh@users.mediawiki.org>
Tue, 15 Nov 2011 04:28:34 +0000 (04:28 +0000)
committerSanthosh Thottingal <santhosh@users.mediawiki.org>
Tue, 15 Nov 2011 04:28:34 +0000 (04:28 +0000)
Use negative sign itself instead of $_[0] since $_ is mixed type.
Add more test cases.

languages/Language.php
tests/phpunit/languages/LanguageMlTest.php

index 48fd882..84e9cbd 100644 (file)
@@ -2725,7 +2725,7 @@ class Language {
                        $sign = "";
                        if ( intval( $_ ) < 0 ) {
                                // For negative numbers apply the algorithm like positive number and add sign.
-                               $sign =   $_[0];
+                               $sign =  "-";
                                $_ = substr( $_,1 );
                        }
                        $numberpart = array();
index c659e5c..45091db 100644 (file)
@@ -28,5 +28,7 @@ class LanguageMlTest extends MediaWikiTestCase {
                $this->assertEquals( '.12345', $this->lang->formatNum( '.12345' ) );
                $this->assertEquals( '-12,00,000', $this->lang->formatNum( '-1200000' ) );
                $this->assertEquals( '-98', $this->lang->formatNum( '-98' ) );
+               $this->assertEquals( '-98', $this->lang->formatNum( -98 ) );
+               $this->assertEquals( '-1,23,45,678', $this->lang->formatNum( -12345678 ) );
        }
 }