10000 [Form] Fixed PercentToLocalizedStringTransformer to accept both comma and dot as decimal separator, if possible by aaa2000 · Pull Request #22586 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Fixed PercentToLocalizedStringTransformer to accept both comma and dot as decimal separator, if possible #22586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix failing tests
  • Loading branch information
aaa2000 committed Jul 29, 2017
commit a42fa981a0448d80780d9e58f14ad31af9ee5f45
1 change: 0 additions & 1 deletion src/Symfony/Component/Form/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ CHANGELOG
* "choice_value"
* "choice_attr"
* "group_by"
* added PercentToLocalizedStringTransformer to accept both comma and dot as decimal separator, if possible

2.6.2
-----
Expand Down
5ED4
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public function testReverseTransformExpectsString()

public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
{
IntlTestHelper::requireFullIntl($this, '4.8.1.1');

\Locale::setDefault('fr');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests are failing because this method is not always available, can you fix it @aaa2000 ?

$transformer = new PercentToLocalizedStringTransformer(1, 'integer');

Expand All @@ -139,10 +141,10 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
*/
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
{
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this, '4.8.1.1');

\Locale::setDefault('de_DE');
\Locale::setDefault('de_AT');

$transformer = new PercentToLocalizedStringTransformer(1, 'integer');

Expand All @@ -155,7 +157,7 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
{
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
IntlTestHelper::requireFullIntl($this, '4.8.1.1');

\Locale::setDefault('de_DE');

Expand All @@ -179,7 +181,7 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupin
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
IntlTestHelper::requireFullIntl($this, '4.8.1.1');

\Locale::setDefault('bg');
$transformer = new PercentToLocalizedStringTransformer(1, 'integer');
Expand All @@ -198,6 +200,8 @@ public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
*/
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
{
IntlTestHelper::requireFullIntl($this, '4.8.1.1');

$transformer = new PercentToLocalizedStringTransformer(1, 'integer');

$transformer->reverseTransform('1,234,5');
Expand All @@ -208,6 +212,8 @@ public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
*/
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsCommaWithNoGroupSep()
{
IntlTestHelper::requireFullIntl($this, '4.8.1.1');

$transformer = new PercentToLocalizedStringTransformer(1, 'integer');

$transformer->reverseTransform('1234,5');
Expand Down
0