yii2: FormatterNumberTest::testIntlAsScientific fails on GitLab
What steps will reproduce the problem?
See tests here: https://gitlab.com/yiisoft/yii2/-/jobs/368388365
What is the expected result?
No failure or error.
What do you get instead?
There was 1 failure:
573 1) yiiunit\framework\i18n\FormatterNumberTest::testIntlAsScientific
574 Failed asserting that two strings are identical.
575 --- Expected
576 +++ Actual
577 @@ @@
578 -8.76543210987654E16
579 +8.765432109876544E16
580 /project/tests/framework/i18n/FormatterNumberTest.php:531
581 /project/vendor/phpunit/phpunit/phpunit:52
Additional info
| Q | A |
|---|---|
| Yii version | master |
| PHP version | 7.1.33 |
| Operating system | Debian (Docker) |
Looks like there’s one more digit now?! Test fails since https://gitlab.com/yiisoft/yii2/commit/c1e9739ed232e207ff6920e90b7351b2b19f69d0
Pipelines: https://gitlab.com/yiisoft/yii2/pipelines
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 28 (28 by maintainers)
Commits related to this issue
- tes format with max. digits, see also https://github.com/yiisoft/yii2/issues/17708 — committed to schmunk42/yii2 by schmunk42 5 years ago
- fixed #17708 (intl number formatter) — committed to schmunk42/yii2 by schmunk42 4 years ago
- updated TEST_YII_VERSION - related https://github.com/yiisoft/yii2/issues/17708 — committed to yiisoft/yii2-docker by schmunk42 4 years ago
IMHO; either there should be a global default for precision, or the test should specify it. I believe the test should specify it, as it depends on the underlying system.
https://github.com/yiisoft/yii2/blob/master/tests/framework/i18n/FormatterNumberTest.php#L531
Overall conclusion is that the test is doing more harm than good. Going to mark it as always skipped.
Yes will do a pr tomorrow morning, but I do not have the time to locally test it, I have the yii2 project not setup in that way. Might do that when I have more time available.
Seems to me like a bug in Yii. Php default is precision 14, but if intl is used - there is no default set. At least I cannot see any here: https://www.php.net/manual/en/class.numberformatter.php
Maybe would be good to set defaults.
The info at the function
asScientific- its not prominent enough.