Index: tests/Zend/Form/FormTest.php =================================================================== --- tests/Zend/Form/FormTest.php (revision 25022) +++ tests/Zend/Form/FormTest.php (working copy) @@ -137,7 +137,6 @@ { $options = $this->getOptions(); $options['pluginLoader'] = true; - $options['subForms'] = true; $options['view'] = true; $options['translator'] = true; $options['default'] = true; @@ -4554,6 +4553,124 @@ $this->assertContains('Foo', $paths[0]); } } + + public function testNameAttributeOutputForXhtml() + { + // Create form + $form = new Zend_Form(); + $form->setName('foo'); + $form->setMethod(Zend_Form::METHOD_GET); + $form->removeDecorator('HtmlTag'); + + // Set doctype + $this->getView()->getHelper('doctype')->doctype( + Zend_View_Helper_Doctype::XHTML1_STRICT + ); + + $expected = '
' + . PHP_EOL + . '
'; + + $this->assertSame( + $expected, + $form->render($this->getView()) + ); + } + + /** + * @group ZF-5613 + */ + public function testAddSubFormsPerConfig() + { + // Create form + $form = new Zend_Form( + array( + 'subForms' => array( + array( + 'form' => array( + 'elements' => array( + 'foo' => array( + 'text', + array( + 'label' => 'Foo', + 'decorators' => array( + 'ViewHelper', + 'Label', + ), + ), + ), + ), + 'id' => 'subform1', + 'decorators' => array( + 'FormElements', + ), + ), + 'name' => 'subform1', + 'order' => 2, + ), + array( + 'form' => array( + 'elements' => array( + 'bar' => array( + 'text', + array( + 'label' => 'Bar', + 'decorators' => array( + 'ViewHelper', + 'Label', + ), + ), + ), + ), + 'id' => 'subform2', + 'decorators' => array( + 'FormElements', + ), + ), + 'name' => 'subform2', + 'order' => 1, + ), + ), + ) + ); + $form->removeDecorator('HtmlTag'); + + // Tests + $subForms = $form->getSubForms(); + $subForm1 = current($subForms); + $subForm2 = next($subForms); + + $this->assertSame( + array( + 'subform1', + 'subform2', + ), + array( + $subForm1->getName(), + $subForm2->getName(), + ) + ); + + $expected = '
' + . PHP_EOL + . PHP_EOL + . '' + . PHP_EOL + . PHP_EOL + . '' + . PHP_EOL + . PHP_EOL + . '' + . PHP_EOL + . PHP_EOL + . '' + . '
'; + + $this->assertSame( + $expected, + $form->render($this->getView()) + ); + } } class Zend_Form_FormTest_DisplayGroup extends Zend_Form_DisplayGroup