Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5653b4e

Browse files
committed
fix rounding from string
1 parent 6e80476 commit 5653b4e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,12 @@ public function testFloatToIntConversionMismatchOnReversTransform()
8080
\Locale::setDefault('de_AT');
8181
$this->assertSame(3655, (int) $transformer->reverseTransform('36,55'));
8282
}
83+
84+
public function testFloatToIntConversionMismatchOnTransform()
85+
{
86+
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
87+
IntlTestHelper::requireFullIntl($this, false);
88+
\Locale::setDefault('de_AT');
89+
$this->assertSame('36,55', (int) $transformer->transform(3655));
90+
}
8391
}

src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ public function formatRoundingModeRoundHalfUpProvider()
428428
// array(1.125, '1.13'),
429429
array(1.127, '1.13'),
430430
array(1.129, '1.13'),
431+
array('1.20', '1.20'),
431432
);
432433
}
433434

@@ -451,6 +452,7 @@ public function formatRoundingModeRoundHalfDownProvider()
451452
array(1.125, '1.12'),
452453
array(1.127, '1.13'),
453454
array(1.129, '1.13'),
455+
array('1.20', '1.20'),
454456
);
455457
}
456458

@@ -474,6 +476,7 @@ public function formatRoundingModeRoundHalfEvenProvider()
474476
array(1.125, '1.12'),
475477
array(1.127, '1.13'),
476478
array(1.129, '1.13'),
479+
array('1.20', '1.20'),
477480
);
478481
}
479482

@@ -498,6 +501,7 @@ public function formatRoundingModeRoundCeilingProvider()
498501
array(-1.123, '-1.12'),
499502
array(-1.125, '-1.12'),
500503
array(-1.127, '-1.12'),
504+
array('1.20', '1.20'),
501505
);
502506
}
503507

@@ -522,6 +526,7 @@ public function formatRoundingModeRoundFloorProvider()
522526
array(-1.123, '-1.13'),
523527
array(-1.125, '-1.13'),
524528
array(-1.127, '-1.13'),
529+
array('1.20', '1.20'),
525530
);
526531
}
527532

@@ -546,6 +551,7 @@ public function formatRoundingModeRoundDownProvider()
546551
array(-1.123, '-1.12'),
547552
array(-1.125, '-1.12'),
548553
array(-1.127, '-1.12'),
554+
array('1.20', '1.20'),
549555
);
550556
}
551557

@@ -570,6 +576,7 @@ public function formatRoundingModeRoundUpProvider()
570576
array(-1.123, '-1.13'),
571577
array(-1.125, '-1.13'),
572578
array(-1.127, '-1.13'),
579+
array('1.20', '1.20'),
573580
);
574581
}
575582

0 commit comments

Comments
 (0)