[Form] action allows only strings

This commit is contained in:
Maxime Helias 2020-04-01 10:54:50 +02:00 committed by Fabien Potencier
parent ba52c62516
commit e861500ce8
2 changed files with 7 additions and 0 deletions

View File

@ -203,6 +203,7 @@ class FormType extends BaseType
]);
$resolver->setAllowedTypes('label_attr', 'array');
$resolver->setAllowedTypes('action', 'string');
$resolver->setAllowedTypes('upload_max_size_message', ['callable']);
$resolver->setAllowedTypes('help', ['string', 'null']);
$resolver->setAllowedTypes('help_attr', 'array');

View File

@ -341,6 +341,12 @@ class FormTypeTest extends BaseTypeTest
$this->factory->create(static::TESTED_TYPE, null, ['attr' => '']);
}
public function testActionCannotBeNull()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, ['action' => null]);
}
public function testNameCanBeEmptyString()
{
$form = $this->factory->createNamed('', static::TESTED_TYPE);