Permalink
Browse files

Added test for #2541

  • Loading branch information...
1 parent 6361e50 commit 86d399761198f892b35d233ce57b91bd21f18e78 @davidwindell committed Nov 19, 2012
Showing with 28 additions and 0 deletions.
  1. +28 −0 tests/ZendTest/Form/FormTest.php
@@ -1025,6 +1025,34 @@ public function testRemoveCollectionFromValidationGroupWhenZeroCountAndNoData()
$this->assertTrue($this->form->isValid());
}
+ public function testFieldsetValidationGroupStillPreparedWhenEmptyData()
+ {
+ $emptyData = array();
+
+ $this->populateForm();
+ $this->form->get('foobar')->add(array(
+ 'type' => 'Zend\Form\Element\Collection',
+ 'name' => 'categories',
+ 'options' => array(
+ 'count' => 0,
+ 'target_element' => array(
+ 'type' => 'ZendTest\Form\TestAsset\CategoryFieldset'
+ )
+ )
+ ));
+
+ $this->form->setValidationGroup(array(
+ 'foobar' => array(
+ 'categories' => array(
+ 'name'
+ )
+ )
+ ));
+
+ $this->form->setData($emptyData);
+ $this->assertFalse($this->form->isValid());
+ }
+
public function testApplyObjectInputFilterToBaseFieldsetAndApplyValidationGroup()
{
$fieldset = new Fieldset('foobar');

0 comments on commit 86d3997

Please sign in to comment.