Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added test

  • Loading branch information...
commit 69a76f5aa4e5b7fe367e5b4c532353144f55baad 1 parent 45c1728
David Windell authored August 01, 2012

Showing 1 changed file with 36 additions and 0 deletions. Show diff stats Hide diff stats

  1. 36  tests/Zend/Form/FormTest.php
36  tests/Zend/Form/FormTest.php
@@ -892,6 +892,7 @@ public function testUnsetValuesNotBound()
892 892
         $this->assertObjectNotHasAttribute('foo', $data);
893 893
         $this->assertObjectHasAttribute('bar', $data);
894 894
     }
  895
+
895 896
     public function testRemoveCollectionFromValidationGroupWhenZeroCountAndNoData()
896 897
     {
897 898
         $dataWithoutCollection = array(
@@ -917,4 +918,39 @@ public function testRemoveCollectionFromValidationGroupWhenZeroCountAndNoData()
917 918
         $this->form->setData($dataWithoutCollection);
918 919
         $this->assertTrue($this->form->isValid());
919 920
     }
  921
+
  922
+    public function testApplyObjectInputFilterToBaseFieldsetAndApplyValidationGroup()
  923
+    {
  924
+        $fieldset = new Fieldset('foobar');
  925
+        $fieldset->add(new Element('foo'));
  926
+        $fieldset->setUseAsBaseFieldset(true);
  927
+        $this->form->add($fieldset);
  928
+        $this->form->setValidationGroup(array(
  929
+            'foobar'=> array(
  930
+                'foo',
  931
+            )
  932
+        ));
  933
+
  934
+        $inputFilterFactory = new InputFilterFactory();
  935
+        $inputFilter = $inputFilterFactory->createInputFilter(array(
  936
+            'foo' => array(
  937
+                'name'       => 'foo',
  938
+                'required'   => true,
  939
+            ),
  940
+        ));
  941
+        $model = new TestAsset\ValidatingModel();
  942
+        $model->setInputFilter($inputFilter);
  943
+        $this->form->bind($model);
  944
+
  945
+        $this->form->setData(array());
  946
+        $this->assertFalse($this->form->isValid());
  947
+
  948
+        $validSet = array(
  949
+            'foobar' => array(
  950
+                'foo' => 'abcde',
  951
+            )
  952
+        );
  953
+        $this->form->setData($validSet);
  954
+        $this->assertTrue($this->form->isValid());
  955
+    }
920 956
 }

0 notes on commit 69a76f5

Please sign in to comment.
Something went wrong with that request. Please try again.