1010use Illuminate \Http \Request ;
1111use Illuminate \Http \UploadedFile ;
1212use Illuminate \Support \Facades \Event ;
13- use Illuminate \Support \Facades \Session ;
1413use Illuminate \Support \Facades \Storage ;
1514use Mockery ;
1615use PHPUnit \Framework \Constraint \StringContains ;
@@ -29,13 +28,11 @@ protected function setUp(): void
2928 {
3029 parent ::setUp ();
3130
31+ $ this ->app ->make ('config ' )->set ('chunk-uploader.identifier ' , 'nop ' );
3232 $ this ->app ->make ('config ' )->set ('chunk-uploader.uploader ' , 'blueimp ' );
3333 $ this ->app ->make ('config ' )->set ('chunk-uploader.sweep ' , false );
3434 $ this ->handler = $ this ->app ->make (UploadHandler::class);
3535
36- Session::shouldReceive ('getId ' )
37- ->andReturn ('frgYt7cPmNGtORpRCo4xvFIrWklzFqc2mnO6EE6b ' );
38-
3936 Storage::fake ('local ' );
4037 Event::fake ();
4138 }
@@ -82,7 +79,7 @@ public function testDownload()
8279 'download ' => 1 ,
8380 ]);
8481
85- /** @var \Illuminate\Foundation\ Testing\TestResponse|\Symfony\Component\HttpFoundation\BinaryFileResponse $response */
82+ /** @var \Illuminate\Testing\TestResponse|\Symfony\Component\HttpFoundation\BinaryFileResponse $response */
8683 $ response = $ this ->createTestResponse ($ this ->handler ->handle ($ request ));
8784 $ response ->assertSuccessful ();
8885 $ response ->assertStatus (200 );
@@ -94,10 +91,10 @@ public function testDownload()
9491
9592 public function testResume ()
9693 {
97- $ this ->createFakeLocalFile ('chunks/4f0fce4ab7d03efd246b25d3c9e6546a0d65794d ' , '000-099 ' );
94+ $ this ->createFakeLocalFile ('chunks/200_test.txt ' , '000-099 ' );
9895
9996 $ request = Request::create ('' , Request::METHOD_GET , [
100- 'file ' => '2494cefe4d234bd331aeb4514fe97d810efba29b .txt ' ,
97+ 'file ' => 'test .txt ' ,
10198 'totalSize ' => '200 ' ,
10299 ]);
103100
@@ -106,7 +103,7 @@ public function testResume()
106103
107104 $ response ->assertJson ([
108105 'file ' => [
109- 'name ' => '2494cefe4d234bd331aeb4514fe97d810efba29b .txt ' ,
106+ 'name ' => 'test .txt ' ,
110107 'size ' => 100 ,
111108 ],
112109 ]);
@@ -145,12 +142,11 @@ public function testUploadFirstChunk()
145142 'HTTP_CONTENT_RANGE ' => 'bytes 0-99/200 ' ,
146143 ]);
147144
148- /** @var \Illuminate\Foundation\Testing\TestResponse $response */
149145 $ response = $ this ->createTestResponse ($ this ->handler ->handle ($ request ));
150146 $ response ->assertSuccessful ();
151147 $ response ->assertJson (['done ' => 50 ]);
152148
153- Storage::disk ('local ' )->assertExists ('chunks/5d5115c1064c6e9dead0b7b71506bdfe273fd11c /000-099 ' );
149+ Storage::disk ('local ' )->assertExists ('chunks/200_test.txt /000-099 ' );
154150
155151 Event::assertNotDispatched (FileUploaded::class, function ($ event ) use ($ file ) {
156152 return $ event ->file = $ file ->hashName ('merged ' );
@@ -177,7 +173,7 @@ public function testUploadFirstChunkWithCallback()
177173
178174 public function testUploadLastChunk ()
179175 {
180- $ this ->createFakeLocalFile ('chunks/2494cefe4d234bd331aeb4514fe97d810efba29b .txt ' , '000 ' );
176+ $ this ->createFakeLocalFile ('chunks/200_test .txt ' , '000 ' );
181177
182178 $ file = UploadedFile::fake ()->create ('test.txt ' , 100 );
183179 $ request = Request::create ('' , Request::METHOD_POST , [], [], [
@@ -186,12 +182,11 @@ public function testUploadLastChunk()
186182 'HTTP_CONTENT_RANGE ' => 'bytes 100-199/200 ' ,
187183 ]);
188184
189- /** @var \Illuminate\Foundation\Testing\TestResponse $response */
190185 $ response = $ this ->createTestResponse ($ this ->handler ->handle ($ request ));
191186 $ response ->assertSuccessful ();
192187 $ response ->assertJson (['done ' => 100 ]);
193188
194- Storage::disk ('local ' )->assertExists ('chunks/5d5115c1064c6e9dead0b7b71506bdfe273fd11c /100-199 ' );
189+ Storage::disk ('local ' )->assertExists ('chunks/200_test.txt /100-199 ' );
195190 Storage::disk ('local ' )->assertExists ($ file ->hashName ('merged ' ));
196191
197192 Event::assertDispatched (FileUploaded::class, function ($ event ) use ($ file ) {
@@ -201,7 +196,7 @@ public function testUploadLastChunk()
201196
202197 public function testUploadLastChunkWithCallback ()
203198 {
204- $ this ->createFakeLocalFile ('chunks/2494cefe4d234bd331aeb4514fe97d810efba29b .txt ' , '000 ' );
199+ $ this ->createFakeLocalFile ('chunks/200_test .txt ' , '000 ' );
205200
206201 $ file = UploadedFile::fake ()->create ('test.txt ' , 100 );
207202 $ request = Request::create ('' , Request::METHOD_POST , [], [], [
0 commit comments