Skip to content

Commit

Permalink
[Form] added some missing tests for previous merge
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 24, 2011
1 parent c832b71 commit 78ebe11
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/Symfony/Tests/Component/Form/AbstractDivLayoutTest.php
Expand Up @@ -238,7 +238,7 @@ public function testRestAndRepeatedWithWidgetPerField()
->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']);
Expand Down Expand Up @@ -372,7 +372,7 @@ public function testRepeated()
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')
));

Expand Down
Expand Up @@ -53,7 +53,7 @@ public function testSetOptionsPerField()
{
$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')
));

Expand All @@ -63,6 +63,17 @@ public function testSetOptionsPerField()
$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(
Expand Down

2 comments on commit 78ebe11

@stloyd
Copy link
Contributor

@stloyd stloyd commented on 78ebe11 Sep 24, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main reason for usage of 'first_options' => array('required' => false) was to prove that field options cannot override global required option.

@fabpot
Copy link
Member Author

@fabpot fabpot commented on 78ebe11 Sep 24, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, right. I've readded those tests and added a comment.

Please sign in to comment.