diff --git a/tests/ZendTest/Form/FormTest.php b/tests/ZendTest/Form/FormTest.php index 8bc6c12bd5b..d6953742147 100644 --- a/tests/ZendTest/Form/FormTest.php +++ b/tests/ZendTest/Form/FormTest.php @@ -1676,4 +1676,19 @@ public function testPreferFormInputFilterFlagIsEnabledByDefault() { $this->assertTrue($this->form->getPreferFormInputFilter()); } + + public function testFileInputFilterNotOverwritten() + { + $form = new TestAsset\FileInputFilterProviderForm(); + + $formInputFilter = $form->getInputFilter(); + $fieldsetInputFilter = $formInputFilter->get('file_fieldset'); + $fileFilter = $fieldsetInputFilter->get('file_field'); + + $this->assertInstanceOf('Zend\InputFilter\FileInput', $fileFilter); + + $chain = $fileFilter->getFilterChain(); + + $this->assertCount(1, $chain); + } } diff --git a/tests/ZendTest/Form/TestAsset/FileInputFilterProviderFieldset.php b/tests/ZendTest/Form/TestAsset/FileInputFilterProviderFieldset.php new file mode 100644 index 00000000000..1420c55f925 --- /dev/null +++ b/tests/ZendTest/Form/TestAsset/FileInputFilterProviderFieldset.php @@ -0,0 +1,48 @@ +add(array( + 'type' => 'file', + 'name' => 'file_field', + 'options' => array( + 'label' => 'File Label', + ), + )); + + } + + public function getInputFilterSpecification() + { + return array( + 'file_field' => array( + 'filters' => array( + array( + 'name' => 'filerenameupload', + 'options' => array( + 'target' => __FILE__, + 'randomize' => true, + ), + ), + ), + ), + ); + } +} diff --git a/tests/ZendTest/Form/TestAsset/FileInputFilterProviderForm.php b/tests/ZendTest/Form/TestAsset/FileInputFilterProviderForm.php new file mode 100644 index 00000000000..21f9cd5a6ca --- /dev/null +++ b/tests/ZendTest/Form/TestAsset/FileInputFilterProviderForm.php @@ -0,0 +1,27 @@ +add(array( + 'type' => __NAMESPACE__ . '\FileInputFilterProviderFieldset', + 'name' => 'file_fieldset', + )); + } +}