@@ -515,7 +515,7 @@ public function testAsCurrency()
515
515
public function testIntlAsScientific ()
516
516
{
517
517
$ value = '123 ' ;
518
- $ this ->assertSame ('1.23E2 ' , $ this ->formatter ->asScientific ($ value ));
518
+ $ this ->assertSame ('1.23E2 ' , $ this ->formatter ->asScientific ($ value, 2 ));
519
519
$ value = '123456 ' ;
520
520
$ this ->assertSame ('1.23456E5 ' , $ this ->formatter ->asScientific ($ value ));
521
521
$ value = '-123456.123 ' ;
@@ -528,7 +528,10 @@ public function testIntlAsScientific()
528
528
// null display
529
529
$ this ->assertSame ($ this ->formatter ->nullDisplay , $ this ->formatter ->asScientific (null ));
530
530
531
- $ this ->assertSame ('8.76543210987654E16 ' , $ this ->formatter ->asScientific ('87654321098765436 ' ));
531
+ // precision (see also https://github.com/yiisoft/yii2/issues/17708)
532
+ $ this ->assertSame ('9E16 ' , $ this ->formatter ->asScientific ('87654321098765436 ' , 0 ));
533
+ $ this ->assertSame ('8.8E16 ' , $ this ->formatter ->asScientific ('87654321098765436 ' , 1 ));
534
+ $ this ->assertSame ('8.765432109877E16 ' , $ this ->formatter ->asScientific ('87654321098765436 ' , 12 ));
532
535
}
533
536
534
537
public function testAsScientific ()
@@ -548,6 +551,11 @@ public function testAsScientific()
548
551
$ this ->assertSame ($ this ->formatter ->nullDisplay , $ this ->formatter ->asScientific (null ));
549
552
550
553
$ this ->assertSame ('8.765432E+16 ' , $ this ->formatter ->asScientific ('87654321098765436 ' ));
554
+
555
+ // precision (see also https://github.com/yiisoft/yii2/issues/17708)
556
+ $ this ->assertSame ('9E+16 ' , $ this ->formatter ->asScientific ('87654321098765436 ' , 0 ));
557
+ $ this ->assertSame ('8.8E+16 ' , $ this ->formatter ->asScientific ('87654321098765436 ' , 1 ));
558
+ $ this ->assertSame ('8.765432109877E+16 ' , $ this ->formatter ->asScientific ('87654321098765436 ' , 12 ));
551
559
}
552
560
553
561
public function testIntlAsSpellout ()
0 commit comments