mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-10 02:13:17 +08:00
fixed currency format with custom decimal fraction
fixes #12345 close #12648
This commit is contained in:
committed by
Carsten Brandt
parent
a51dadc866
commit
50f3012f68
@ -305,6 +305,15 @@ class FormatterNumberTest extends TestCase
|
||||
$this->assertSame("0,00 €", $this->formatter->asCurrency(false));
|
||||
$this->assertSame("0,00 €", $this->formatter->asCurrency(""));
|
||||
|
||||
// decimal formatting
|
||||
$this->formatter->locale = 'de-DE';
|
||||
$this->assertSame("100 $", \Yii::$app->formatter->asCurrency(100, 'USD', [
|
||||
NumberFormatter::MAX_FRACTION_DIGITS => 0,
|
||||
]));
|
||||
$this->assertSame("100,00 $", $this->formatter->asCurrency(100, 'USD', [
|
||||
NumberFormatter::MAX_FRACTION_DIGITS => 2
|
||||
]));
|
||||
|
||||
// null display
|
||||
$this->assertSame($this->formatter->nullDisplay, $this->formatter->asCurrency(null));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user