Permalink
Browse files

[#5015] Added unit tests

- Added tests to demonstrate that preferFormInputFilter flag can now be set via
  options and factory implementations.
  • Loading branch information...
1 parent 6174beb commit d7eba459a4b054aeeb1382056c6a4da5cc8afcfa @weierophinney weierophinney committed Aug 26, 2013
Showing with 24 additions and 1 deletion.
  1. +24 −1 tests/ZendTest/Form/FormTest.php
View
25 tests/ZendTest/Form/FormTest.php
@@ -1633,10 +1633,33 @@ public function testInputFilterOrderOfPrecedence1()
)
);
- $factory = new \Zend\Form\Factory();
+ $factory = new Factory();
$this->form = $factory->createForm($spec);
$this->form->setPreferFormInputFilter(true);
$this->assertFalse($this->form->getInputFilter()->get('element')
->isRequired());
}
+
+ public function testCanSetPreferFormInputFilterFlagViaSetOptions()
+ {
+ $flag = ! $this->form->getPreferFormInputFilter();
+ $this->form->setOptions(array(
+ 'prefer_form_input_filter' => $flag,
+ ));
+ $this->assertSame($flag, $this->form->getPreferFormInputFilter());
+ }
+
+ public function testFactoryCanSetPreferFormInputFilterFlag()
+ {
+ $factory = new Factory();
+ foreach (array(true, false) as $flag) {
+ $form = $factory->createForm(array(
+ 'name' => 'form',
+ 'options' => array(
+ 'prefer_form_input_filter' => $flag,
+ ),
+ ));
+ $this->assertSame($flag, $form->getPreferFormInputFilter());
+ }
+ }
}

0 comments on commit d7eba45

Please sign in to comment.