[Form] added some missing tests for previous merge

This commit is contained in:
Fabien Potencier 2011-09-24 15:28:16 +02:00
parent c832b71600
commit 78ebe11a0c
2 changed files with 14 additions and 3 deletions

View File

@ -238,7 +238,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
->getForm()
->createView();
// The password form is considered as rendered as all its childrend
// The password form is considered as rendered as all its children
// are rendered
$this->renderWidget($view['password']['first']);
$this->renderWidget($view['password']['second']);
@ -372,7 +372,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRepeatedWithCustomOptions()
{
$form = $this->factory->createNamed('repeated', 'name', null, array(
'first_options' => array('label' => 'Test', 'required' => false),
'first_options' => array('label' => 'Test'),
'second_options' => array('label' => 'Test2')
));

View File

@ -53,7 +53,7 @@ class RepeatedTypeTest extends TypeTestCase
{
$form = $this->factory->create('repeated', null, array(
'type' => 'field',
'first_options' => array('label' => 'Test', 'required' => false),
'first_options' => array('label' => 'Test'),
'second_options' => array('label' => 'Test2')
));
@ -63,6 +63,17 @@ class RepeatedTypeTest extends TypeTestCase
$this->assertTrue($form['second']->isRequired());
}
public function testSetRequired()
{
$form = $this->factory->create('repeated', null, array(
'required' => false,
'type' => 'field',
));
$this->assertFalse($form['first']->isRequired());
$this->assertFalse($form['second']->isRequired());
}
public function testSetOptionsPerFieldAndOverwrite()
{
$form = $this->factory->create('repeated', null, array(