[Form] Fixed inheritance of "error_bubbling" in RepeatedType
This commit is contained in:
parent
114bbce806
commit
c526ad9db6
@ -27,6 +27,10 @@ class RepeatedType extends AbstractType
|
||||
$options['first_options']['required'] = $options['required'];
|
||||
$options['second_options']['required'] = $options['required'];
|
||||
|
||||
if (!isset($options['options']['error_bubbling'])) {
|
||||
$options['options']['error_bubbling'] = $options['error_bubbling'];
|
||||
}
|
||||
|
||||
$builder
|
||||
->addViewTransformer(new ValueToDuplicatesTransformer(array(
|
||||
$options['first_name'],
|
||||
|
@ -72,6 +72,41 @@ class RepeatedTypeTest extends TypeTestCase
|
||||
$this->assertFalse($form['second']->isRequired());
|
||||
}
|
||||
|
||||
public function testSetErrorBubblingToTrue()
|
||||
{
|
||||
$form = $this->factory->create('repeated', null, array(
|
||||
'error_bubbling' => true,
|
||||
));
|
||||
|
||||
$this->assertTrue($form->getConfig()->getOption('error_bubbling'));
|
||||
$this->assertTrue($form['first']->getConfig()->getOption('error_bubbling'));
|
||||
$this->assertTrue($form['second']->getConfig()->getOption('error_bubbling'));
|
||||
}
|
||||
|
||||
public function testSetErrorBubblingToFalse()
|
||||
{
|
||||
$form = $this->factory->create('repeated', null, array(
|
||||
'error_bubbling' => false,
|
||||
));
|
||||
|
||||
$this->assertFalse($form->getConfig()->getOption('error_bubbling'));
|
||||
$this->assertFalse($form['first']->getConfig()->getOption('error_bubbling'));
|
||||
$this->assertFalse($form['second']->getConfig()->getOption('error_bubbling'));
|
||||
}
|
||||
|
||||
public function testSetErrorBubblingIndividually()
|
||||
{
|
||||
$form = $this->factory->create('repeated', null, array(
|
||||
'error_bubbling' => true,
|
||||
'options' => array('error_bubbling' => false),
|
||||
'second_options' => array('error_bubbling' => true),
|
||||
));
|
||||
|
||||
$this->assertTrue($form->getConfig()->getOption('error_bubbling'));
|
||||
$this->assertFalse($form['first']->getConfig()->getOption('error_bubbling'));
|
||||
$this->assertTrue($form['second']->getConfig()->getOption('error_bubbling'));
|
||||
}
|
||||
|
||||
public function testSetOptionsPerChildAndOverwrite()
|
||||
{
|
||||
$form = $this->factory->create('repeated', null, array(
|
||||
|
Reference in New Issue
Block a user