Merge branch '2.7' into 2.8
* 2.7: [Form] Choice type int values (BC Fix)
This commit is contained in:
commit
3c37037138
@ -171,8 +171,8 @@ class ChoiceType extends AbstractType
|
||||
}
|
||||
|
||||
foreach ($data as $v) {
|
||||
if (null !== $v && !is_string($v)) {
|
||||
throw new TransformationFailedException('All choices submitted must be NULL or strings.');
|
||||
if (null !== $v && !is_string($v) && !is_int($v)) {
|
||||
throw new TransformationFailedException('All choices submitted must be NULL, strings or ints.');
|
||||
}
|
||||
}
|
||||
}, 256);
|
||||
|
@ -1698,6 +1698,19 @@ class ChoiceTypeTest extends BaseTypeTest
|
||||
$this->assertNull($form[4]->getViewData());
|
||||
}
|
||||
|
||||
public function testSubmitMultipleChoicesInts()
|
||||
{
|
||||
$form = $this->factory->create(static::TESTED_TYPE, null, array(
|
||||
'multiple' => true,
|
||||
'choices' => array_flip($this->numericChoicesFlipped),
|
||||
'choices_as_values' => true,
|
||||
));
|
||||
|
||||
$form->submit(array(1, 2));
|
||||
|
||||
$this->assertTrue($form->isSynchronized());
|
||||
}
|
||||
|
||||
public function testSingleSelectedObjectChoices()
|
||||
{
|
||||
$view = $this->factory->create(static::TESTED_TYPE, $this->objectChoices[3], array(
|
||||
@ -2315,7 +2328,7 @@ class ChoiceTypeTest extends BaseTypeTest
|
||||
|
||||
$form->submit($submissionData);
|
||||
$this->assertFalse($form->isSynchronized());
|
||||
$this->assertEquals('All choices submitted must be NULL or strings.', $form->getTransformationFailure()->getMessage());
|
||||
$this->assertEquals('All choices submitted must be NULL, strings or ints.', $form->getTransformationFailure()->getMessage());
|
||||
}
|
||||
|
||||
public function invalidNestedValueTestMatrix()
|
||||
|
Reference in New Issue
Block a user