File tree Expand file tree Collapse file tree 3 files changed +90
-0
lines changed Expand file tree Collapse file tree 3 files changed +90
-0
lines changed Original file line number Diff line number Diff line change @@ -1676,4 +1676,19 @@ public function testPreferFormInputFilterFlagIsEnabledByDefault()
1676
1676
{
1677
1677
$ this ->assertTrue ($ this ->form ->getPreferFormInputFilter ());
1678
1678
}
1679
+
1680
+ public function testFileInputFilterNotOverwritten ()
1681
+ {
1682
+ $ form = new TestAsset \FileInputFilterProviderForm ();
1683
+
1684
+ $ formInputFilter = $ form ->getInputFilter ();
1685
+ $ fieldsetInputFilter = $ formInputFilter ->get ('file_fieldset ' );
1686
+ $ fileFilter = $ fieldsetInputFilter ->get ('file_field ' );
1687
+
1688
+ $ this ->assertInstanceOf ('Zend\InputFilter\FileInput ' , $ fileFilter );
1689
+
1690
+ $ chain = $ fileFilter ->getFilterChain ();
1691
+
1692
+ $ this ->assertCount (1 , $ chain );
1693
+ }
1679
1694
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Zend Framework (http://framework.zend.com/)
4
+ *
5
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
6
+ * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ * @package Zend_Form
9
+ */
10
+
11
+ namespace ZendTest \Form \TestAsset ;
12
+
13
+ use Zend \Form \Fieldset ;
14
+ use Zend \InputFilter \InputFilterProviderInterface ;
15
+
16
+ class FileInputFilterProviderFieldset extends Fieldset implements InputFilterProviderInterface
17
+ {
18
+ public function __construct ($ name = null , $ options = array ())
19
+ {
20
+ parent ::__construct ($ name , $ options );
21
+
22
+ $ this ->add (array (
23
+ 'type ' => 'file ' ,
24
+ 'name ' => 'file_field ' ,
25
+ 'options ' => array (
26
+ 'label ' => 'File Label ' ,
27
+ ),
28
+ ));
29
+
30
+ }
31
+
32
+ public function getInputFilterSpecification ()
33
+ {
34
+ return array (
35
+ 'file_field ' => array (
36
+ 'filters ' => array (
37
+ array (
38
+ 'name ' => 'filerenameupload ' ,
39
+ 'options ' => array (
40
+ 'target ' => __FILE__ ,
41
+ 'randomize ' => true ,
42
+ ),
43
+ ),
44
+ ),
45
+ ),
46
+ );
47
+ }
48
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Zend Framework (http://framework.zend.com/)
4
+ *
5
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
6
+ * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ * @package Zend_Form
9
+ */
10
+
11
+ namespace ZendTest \Form \TestAsset ;
12
+
13
+ use Zend \Form \Form ;
14
+ use Zend \InputFilter \InputFilterProviderInterface ;
15
+
16
+ class FileInputFilterProviderForm extends Form
17
+ {
18
+ public function __construct ($ name = null , $ options = array ())
19
+ {
20
+ parent ::__construct ($ name , $ options );
21
+
22
+ $ this ->add (array (
23
+ 'type ' => __NAMESPACE__ . '\FileInputFilterProviderFieldset ' ,
24
+ 'name ' => 'file_fieldset ' ,
25
+ ));
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments