Use negative sign itself instead of $_[0] since $_ is mixed type.
Add more test cases.
$sign = "";
if ( intval( $_ ) < 0 ) {
// For negative numbers apply the algorithm like positive number and add sign.
- $sign = $_[0];
+ $sign = "-";
$_ = substr( $_,1 );
}
$numberpart = array();
$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 ) );
}
}