File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
tests/Core/FieldType/EnhancedBinaryFile Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,43 @@ public function testValidateWithMineTypesFromConfig()
128128 $ this ->type ->validate ($ fieldDefinition , $ value );
129129 }
130130
131+ public function testValidateWithNoMimeTypesFromConfig ()
132+ {
133+ $ fieldDefinition = new FieldDefinition (array (
134+ 'fieldSettings ' => array (
135+ 'allowedTypes ' => 'jpg|pdf|txt ' ,
136+ ),
137+ ));
138+
139+ $ value = new Value (array (
140+ 'path ' => $ this ->file ,
141+ ));
142+
143+ $ this ->mimeTypeDetector ->expects ($ this ->once ())
144+ ->method ('getFromPath ' )
145+ ->with ($ this ->file )
146+ ->willReturn ('text/plain ' );
147+
148+ $ this ->configResolver ->expects ($ this ->exactly (3 ))
149+ ->method ('hasParameter ' )
150+ ->will (
151+ $ this ->returnCallback (function ($ arg ) {
152+ if ('txt.Types ' === $ arg ) {
153+ return true ;
154+ }
155+
156+ return false ;
157+ })
158+ );
159+
160+ $ this ->configResolver ->expects ($ this ->once ())
161+ ->method ('getParameter ' )
162+ ->with ('txt.Types ' , 'mime ' )
163+ ->willReturn (array ('something ' ));
164+
165+ $ this ->type ->validate ($ fieldDefinition , $ value );
166+ }
167+
131168 public function testValidateFieldSettingsWithEmptyArray ()
132169 {
133170 $ result = $ this ->type ->validateFieldSettings (array ());
You can’t perform that action at this time.
0 commit comments