@@ -237,6 +237,7 @@ public function testUploadLastChunk()
237237 {
238238 $ this ->createFakeLocalFile ('chunks/200-0jWZTB1ZDfRQU6VTcXy0mJnL9xKMeEz3HoSPU0Zftxt ' , '000-099 ' );
239239
240+ $ file = UploadedFile::fake ()->create ('test.txt ' , 100 );
240241 $ request = Request::create ('' , Request::METHOD_POST , [
241242 'resumableChunkNumber ' => 2 ,
242243 'resumableTotalChunks ' => 2 ,
@@ -248,8 +249,7 @@ public function testUploadLastChunk()
248249 'resumableCurrentChunkSize ' => 100 ,
249250 'resumableType ' => 'text/plain ' ,
250251 ], [], [
251- 'file ' => UploadedFile::fake ()
252- ->create ('test.txt ' , 100 ),
252+ 'file ' => $ file ,
253253 ]);
254254
255255 /** @var \Illuminate\Foundation\Testing\TestResponse $response */
@@ -258,17 +258,18 @@ public function testUploadLastChunk()
258258 $ response ->assertJson (['done ' => 100 ]);
259259
260260 Storage::disk ('local ' )->assertExists ('chunks/200-0jWZTB1ZDfRQU6VTcXy0mJnL9xKMeEz3HoSPU0Zftxt/100-199 ' );
261- Storage::disk ('local ' )->assertExists ('merged/200-0jWZTB1ZDfRQU6VTcXy0mJnL9xKMeEz3HoSPU0Zftxt.txt ' );
261+ Storage::disk ('local ' )->assertExists ($ file -> hashName ( 'merged ' ) );
262262
263- Event::assertDispatched (FileUploaded::class, function ($ event ) {
264- return $ event ->file = 'merged/200-0jWZTB1ZDfRQU6VTcXy0mJnL9xKMeEz3HoSPU0Zftxt.txt ' ;
263+ Event::assertDispatched (FileUploaded::class, function ($ event ) use ( $ file ) {
264+ return $ event ->file = $ file -> hashName ( 'merged ' ) ;
265265 });
266266 }
267267
268268 public function testUploadLastChunkWithCallback ()
269269 {
270270 $ this ->createFakeLocalFile ('chunks/200-0jWZTB1ZDfRQU6VTcXy0mJnL9xKMeEz3HoSPU0Zftxt ' , '000-099 ' );
271271
272+ $ file = UploadedFile::fake ()->create ('test.txt ' , 100 );
272273 $ request = Request::create ('' , Request::METHOD_POST , [
273274 'resumableChunkNumber ' => 2 ,
274275 'resumableTotalChunks ' => 2 ,
@@ -280,19 +281,19 @@ public function testUploadLastChunkWithCallback()
280281 'resumableCurrentChunkSize ' => 100 ,
281282 'resumableType ' => 'text/plain ' ,
282283 ], [], [
283- 'file ' => UploadedFile:: fake ()-> create ( ' test.txt ' , 100 ) ,
284+ 'file ' => $ file ,
284285 ]);
285286
286287 $ callback = $ this ->createClosureMock (
287288 $ this ->once (),
288289 'local ' ,
289- 'merged/200-0jWZTB1ZDfRQU6VTcXy0mJnL9xKMeEz3HoSPU0Zftxt.txt '
290+ $ file -> hashName ( 'merged ' )
290291 );
291292
292293 $ this ->handler ->handle ($ request , $ callback );
293294
294- Event::assertDispatched (FileUploaded::class, function ($ event ) {
295- return $ event ->file = 'merged/200-0jWZTB1ZDfRQU6VTcXy0mJnL9xKMeEz3HoSPU0Zftxt.txt ' ;
295+ Event::assertDispatched (FileUploaded::class, function ($ event ) use ( $ file ) {
296+ return $ event ->file = $ file -> hashName ( 'merged ' ) ;
296297 });
297298 }
298299}
0 commit comments