@@ -121,6 +121,42 @@ public function testFilterAll()
121121 $ this ->assertSame ($ expect , $ actual );
122122 }
123123
124+ public function testIsSuccessAll ()
125+ {
126+ // new fieldset
127+ $ fieldset = $ this ->newFieldset ();
128+
129+ // add fields
130+ $ fieldset ->setField ('foo ' );
131+ $ fieldset ->setField ('bar ' );
132+
133+ // get the filter and add a rule
134+ $ filter = $ fieldset ->getFilter ();
135+ $ filter ->setRule ('foo ' , 'Foo should be alpha ' , function ($ value ) {
136+ return ctype_alpha ($ value );
137+ });
138+
139+ // set values on the fieldset
140+ $ fieldset ->fill (['foo ' => 'foo_value ' , 'bar ' => 'bar_value ' ]);
141+
142+ // Filter has not been called, so isSuccess must return null
143+ $ this ->assertNull ($ fieldset ->isSuccess ());
144+
145+ // apply the filter
146+ $ pass = $ fieldset ->filter ();
147+
148+ // After calling filter, isSuccess should return a boolean
149+ // and filter() should also return a boolean
150+ $ this ->assertFalse ($ fieldset ->isSuccess ());
151+ $ this ->assertFalse ($ pass );
152+
153+ // Let's fix the data and test if isSuccess returns true
154+ $ fieldset ->fill (['foo ' => 'fooValue ' , 'bar ' => 'barValue ' ]);
155+ $ pass = $ fieldset ->filter ();
156+ $ this ->assertTrue ($ fieldset ->isSuccess ());
157+ $ this ->assertTrue ($ pass );
158+ }
159+
124160 public function testSetFieldset ()
125161 {
126162 // a map so the outer fieldset can create the inner fieldset
0 commit comments