Skip to content

Commit

Permalink
bug #26781 [Form] Fix precision of MoneyToLocalizedStringTransformer'…
Browse files Browse the repository at this point in the history
…s divisions on transform() (syastrebov)

This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Fix precision of MoneyToLocalizedStringTransformer's divisions on transform()

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | no
| License       | MIT
| Doc PR        |

Related issue symfony/symfony#21026.
Previous PR symfony/symfony#24036.
Similar fix for `transform()` method.

Commits
-------

f94b7aadd3 fix rounding from string
  • Loading branch information
fabpot committed May 17, 2018
2 parents a9d3893 + 8408721 commit f063c07
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ public function testFloatToIntConversionMismatchOnReversTransform()
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');

$this->assertSame(3655, (int) $transformer->reverseTransform('36,55'));
}

public function testFloatToIntConversionMismatchOnTransform()
{
$transformer = new MoneyToLocalizedStringTransformer(null, null, MoneyToLocalizedStringTransformer::ROUND_DOWN, 100);
IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');

$this->assertSame('10,20', $transformer->transform(1020));
}
}

0 comments on commit f063c07

Please sign in to comment.