This repository was archived by the owner on Sep 10, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -246,9 +246,9 @@ public function saveuploadedAction()
246
246
if ($ this ->isTestingEnv ())
247
247
{
248
248
//simulate file upload
249
- $ path = BASE_PATH .'/tests/testfiles/search.png ' ;
249
+ $ path = $ this ->_getParam ('path ' );
250
+ $ filename = basename ($ path );
250
251
$ file_size = filesize ($ path );
251
- $ filename = 'search.png ' ;
252
252
}
253
253
else
254
254
{
Original file line number Diff line number Diff line change @@ -176,13 +176,21 @@ function testSaveuploadedAction()
176
176
$ this ->params = array ();
177
177
$ this ->params ['parent ' ] = $ userDao ->getPublicFolder ()->getKey ();
178
178
$ this ->params ['license ' ] = 0 ;
179
+ $ this ->params ['path ' ] = BASE_PATH .'/tests/testfiles/search.png ' ; //testing mode param
179
180
$ this ->dispatchUrI ('/upload/saveuploaded ' , $ userDao );
180
181
181
182
$ search = $ this ->Item ->getItemsFromSearch ('search.png ' , $ userDao );
182
- if (empty ($ search ))
183
- {
184
- $ this ->fail ('Unable to find item ' );
185
- }
183
+ $ this ->assertNotEmpty ($ search , 'Unable to find uploaded item ' );
184
+
185
+ // Test to make sure uploading an empty file works
186
+ $ this ->resetAll ();
187
+ $ this ->params ['parent ' ] = $ userDao ->getPublicFolder ()->getKey ();
188
+ $ this ->params ['license ' ] = 0 ;
189
+ $ this ->params ['path ' ] = BASE_PATH .'/tests/testfiles/empty.txt ' ; //testing mode param
190
+ $ this ->dispatchUrI ('/upload/saveuploaded ' , $ userDao );
191
+
192
+ $ search = $ this ->Item ->getItemsFromSearch ('empty.txt ' , $ userDao );
193
+ $ this ->assertNotEmpty ($ search , 'Unable to find empty uploaded item ' );
186
194
}
187
195
188
196
/**
You can’t perform that action at this time.
0 commit comments