@@ -136,6 +136,42 @@ public function testFailsMimeTypeIsValid()
136136 $ validator ->mimeTypeIsValid (['image/png ' ]);
137137 }
138138
139+ public function testPassesExtensionIsNotExcutable ()
140+ {
141+ $ uploaded_file = m::mock (UploadedFile::class);
142+ $ uploaded_file ->shouldReceive ('getClientOriginalExtension ' )->andReturn ('jpeg ' );
143+
144+ $ validator = new LfmUploadValidator ($ uploaded_file );
145+
146+ $ this ->expectNotToPerformAssertions ();
147+
148+ $ validator ->extensionIsNotExcutable (['php ' , 'html ' ]);
149+ }
150+
151+ public function testFailsExtensionIsNotExcutable ()
152+ {
153+ $ uploaded_file = m::mock (UploadedFile::class);
154+ $ uploaded_file ->shouldReceive ('getClientOriginalExtension ' )->andReturn ('html ' );
155+
156+ $ validator = new LfmUploadValidator ($ uploaded_file );
157+
158+ $ this ->expectException (ExcutableFileException::class);
159+
160+ $ validator ->extensionIsNotExcutable (['php ' , 'html ' ]);
161+ }
162+
163+ public function testFailsExtensionIsNotExcutableWithExtensionNotLowerCase ()
164+ {
165+ $ uploaded_file = m::mock (UploadedFile::class);
166+ $ uploaded_file ->shouldReceive ('getClientOriginalExtension ' )->andReturn ('Html ' );
167+
168+ $ validator = new LfmUploadValidator ($ uploaded_file );
169+
170+ $ this ->expectException (ExcutableFileException::class);
171+
172+ $ validator ->extensionIsNotExcutable (['php ' , 'html ' ]);
173+ }
174+
139175 public function testPassesSizeIsLowerThanConfiguredMaximum ()
140176 {
141177 $ uploaded_file = m::mock (UploadedFile::class);
0 commit comments