#17580 compound forms without children should be considered rendered
implicitly
This commit is contained in:
parent
da6c664e98
commit
8234f2add4
@ -65,8 +65,12 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function isRendered()
|
||||
{
|
||||
if (true === $this->rendered || 0 === count($this->children)) {
|
||||
return $this->rendered;
|
||||
if ($this->rendered) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isset($this->vars['compound']) ? !$this->vars['compound'] : 0 === count($this->children)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->children as $child) {
|
||||
|
@ -488,16 +488,67 @@ class FormTypeTest extends BaseTypeTest
|
||||
$this->assertTrue($view->vars['multipart']);
|
||||
}
|
||||
|
||||
public function testViewIsNotRenderedByDefault()
|
||||
public function testViewIsConsideredRenderedForRenderedNonCompoundForms()
|
||||
{
|
||||
$view = $this->factory->createBuilder('form')
|
||||
->add('foo', 'form')
|
||||
$view = $this->factory->createBuilder('form', null, array(
|
||||
'compound' => false,
|
||||
))
|
||||
->getForm()
|
||||
->createView();
|
||||
|
||||
$view->setRendered();
|
||||
|
||||
$this->assertTrue($view->isRendered());
|
||||
}
|
||||
|
||||
public function testViewIsNotConsideredRenderedImplicitlyForNonCompoundForms()
|
||||
{
|
||||
$view = $this->factory->createBuilder('form', null, array(
|
||||
'compound' => false,
|
||||
))
|
||||
->getForm()
|
||||
->createView();
|
||||
|
||||
$this->assertFalse($view->isRendered());
|
||||
}
|
||||
|
||||
public function testViewIsNotConsideredRenderedImplicitlyForCompoundFormsWithNonCompoundChildren()
|
||||
{
|
||||
$view = $this->factory->createBuilder('form')
|
||||
->add('foo', 'form', array(
|
||||
'compound' => false,
|
||||
))
|
||||
->getForm()
|
||||
->createView();
|
||||
|
||||
$this->assertFalse($view->isRendered());
|
||||
}
|
||||
|
||||
public function testViewIsConsideredRenderedImplicitlyForCompoundFormsWithRenderedNonCompoundChildren()
|
||||
{
|
||||
$view = $this->factory->createBuilder('form')
|
||||
->add('foo', 'form', array(
|
||||
'compound' => false,
|
||||
))
|
||||
->getForm()
|
||||
->createView();
|
||||
|
||||
foreach ($view as $child) {
|
||||
$child->setRendered();
|
||||
}
|
||||
|
||||
$this->assertTrue($view->isRendered());
|
||||
}
|
||||
|
||||
public function testViewIsConsideredRenderedImplicitlyForCompoundFormsWithoutChildren()
|
||||
{
|
||||
$view = $this->factory->createBuilder('form')
|
||||
->getForm()
|
||||
->createView();
|
||||
|
||||
$this->assertTrue($view->isRendered());
|
||||
}
|
||||
|
||||
public function testErrorBubblingIfCompound()
|
||||
{
|
||||
$form = $this->factory->create('form', null, array(
|
||||
|
Reference in New Issue
Block a user