@@ -28,41 +28,41 @@ public function test_move_file_job_can_be_dispatched(): void
2828
2929 public function test_move_file_job_moves_file_to_storage (): void
3030 {
31- Storage::fake ('public ' );
32-
3331 $ file = UploadedFile::fake ()->image ('test.jpg ' );
3432 $ tempPath = $ file ->getRealPath ();
3533
3634 $ medium = Medium::factory ()->make ([
3735 'disk ' => 'public ' ,
38- 'path ' => 'media/ test.jpg ' ,
36+ 'file_name ' => 'test.jpg ' ,
3937 ]);
4038
4139 $ job = new MoveFile ($ medium , $ tempPath , true );
4240 $ job ->handle ();
4341
44- Storage::disk ('public ' )->assertExists ('media/test.jpg ' );
42+ Storage::disk ('public ' )->assertExists ('test.jpg ' );
43+
44+ Storage::disk ('public ' )->delete ('test.jpg ' );
4545 }
4646
4747 public function test_move_file_job_deletes_original_when_not_preserved (): void
4848 {
49- Storage::fake ('public ' );
50-
5149 $ tempDir = Storage::disk ('local ' )->path ('root-tmp ' );
5250 $ tempPath = $ tempDir .'/test-file.jpg ' ;
5351 File::ensureDirectoryExists ($ tempDir );
5452 File::put ($ tempPath , 'test content ' );
5553
5654 $ medium = Medium::factory ()->make ([
5755 'disk ' => 'public ' ,
58- 'path ' => 'media/ test.jpg ' ,
56+ 'file_name ' => 'test.jpg ' ,
5957 ]);
6058
6159 $ job = new MoveFile ($ medium , $ tempPath , false );
6260 $ job ->handle ();
6361
64- Storage::disk ('public ' )->assertExists ('media/ test.jpg ' );
62+ Storage::disk ('public ' )->assertExists ('test.jpg ' );
6563 $ this ->assertFalse (File::exists ($ tempPath ));
64+
65+ Storage::disk ('public ' )->delete ('test.jpg ' );
6666 }
6767
6868 public function test_move_file_job_preserves_original_when_preserve_is_true (): void
@@ -76,13 +76,15 @@ public function test_move_file_job_preserves_original_when_preserve_is_true(): v
7676
7777 $ medium = Medium::factory ()->make ([
7878 'disk ' => 'public ' ,
79- 'path ' => 'media/ test.jpg ' ,
79+ 'file_name ' => 'test.jpg ' ,
8080 ]);
8181
8282 $ job = new MoveFile ($ medium , $ tempPath , true );
8383 $ job ->handle ();
8484
85- Storage::disk ('public ' )->assertExists ('media/ test.jpg ' );
85+ Storage::disk ('public ' )->assertExists ('test.jpg ' );
8686 $ this ->assertTrue (File::exists ($ tempPath ));
87+
88+ Storage::disk ('public ' )->delete ('test.jpg ' );
8789 }
8890}
0 commit comments