Skip to content

Commit

Permalink
Fixation form collection helper lost second argument
Browse files Browse the repository at this point in the history
Added second argument to helper call
Added unit test for fixation
  • Loading branch information
olekhy authored and Ocramius committed Feb 2, 2015
1 parent 49f3986 commit fb29987
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/Zend/Form/View/Helper/FormCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function render(ElementInterface $element)

foreach ($element->getIterator() as $elementOrFieldset) {
if ($elementOrFieldset instanceof FieldsetInterface) {
$markup .= $fieldsetHelper($elementOrFieldset);
$markup .= $fieldsetHelper($elementOrFieldset, $this->shouldWrap());
} elseif ($elementOrFieldset instanceof ElementInterface) {
$markup .= $elementHelper($elementOrFieldset);
}
Expand Down Expand Up @@ -178,7 +178,7 @@ public function renderTemplate(CollectionElement $collection)
$elementOrFieldset = $collection->getTemplateElement();

if ($elementOrFieldset instanceof FieldsetInterface) {
$templateMarkup .= $fieldsetHelper($elementOrFieldset);
$templateMarkup .= $fieldsetHelper($elementOrFieldset, $this->shouldWrap());
} elseif ($elementOrFieldset instanceof ElementInterface) {
$templateMarkup .= $elementHelper($elementOrFieldset);
}
Expand Down
20 changes: 20 additions & 0 deletions tests/ZendTest/Form/View/Helper/FormCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,26 @@ public function testRenderWithCustomFieldsetHelper()
$this->assertContains('id="customFieldsetfieldsets"', $markup);
}

public function testShouldNotWrapAtSubInvokeHelper()
{
$form = $this->getForm();

$fact = $this->helper->__invoke($form, false);


$this->assertNotContains('<fieldset', $fact);
}

public function testShouldWrapAtRecursiveHelperCall()
{
$form = $this->getForm();

$fact = $this->helper->__invoke($form);


$this->assertContains('<f ieldset', $fact);
}

public function testShouldWrapReturnsDefaultTrue()
{
$this->assertTrue($this->helper->shouldWrap());
Expand Down

0 comments on commit fb29987

Please sign in to comment.