-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] [MoneyType] Add "input" option #50720
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -123,4 +123,23 @@ public function testHtml5EnablesSpecificFormatting() | |||||
$this->assertSame('12345.60', $form->createView()->vars['value']); | ||||||
$this->assertSame('number', $form->createView()->vars['type']); | ||||||
} | ||||||
|
||||||
public function testHtml5EnablesSpecificFormattingWithIntegerFormat() | ||||||
{ | ||||||
$form = $this->factory->create(static::TESTED_TYPE, null, ['html5' => true, 'scale' => 2, 'input' => 'integer']); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure that a scale option with a value other than But, this makes me wonder if the way this option is currently implemented actually makes sense. So maybe we should indeed allow the |
||||||
$this->assertSame('integer', $form->createView()->vars['type']); | ||||||
} | ||||||
|
||||||
public function testValueToIntegerWithSpecificOptionInputToInteger() | ||||||
{ | ||||||
$form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'integer']); | ||||||
$form->submit('12345.6'); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO this case should trigger an exception in during |
||||||
$this->assertSame(12345, $form->getData()); | ||||||
} | ||||||
|
||||||
public function testInputTypeIntegerAndDivisorNotEgalToOne() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{ | ||||||
$this->expectException(\LogicException::class); | ||||||
$this->factory->create(static::TESTED_TYPE, null, ['divisor' => 2, 'input' => 'integer']); | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the codestyle changes have to be reverted