Skip to content

Commit 2e8205b

Browse files
committed
chore: upgrade tests
1 parent 50c9ef8 commit 2e8205b

14 files changed

+50
-42
lines changed

tests/Driver/BlueimpHandlerTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Http\UploadedFile;
1212
use Illuminate\Support\Facades\Event;
1313
use Illuminate\Support\Facades\Storage;
14+
use Illuminate\Testing\TestResponse;
1415
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1516
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
1617

@@ -60,14 +61,14 @@ public function testMethodNotAllowed($requestMethod)
6061

6162
$this->expectException(MethodNotAllowedHttpException::class);
6263

63-
$this->createTestResponse($this->handler->handle($request));
64+
TestResponse::fromBaseResponse($this->handler->handle($request));
6465
}
6566

6667
public function testInfo()
6768
{
6869
$request = Request::create('', Request::METHOD_HEAD);
6970

70-
$response = $this->createTestResponse($this->handler->handle($request));
71+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
7172
$response->assertSuccessful();
7273

7374
$response->assertHeader('Pragma', 'no-cache');
@@ -86,7 +87,7 @@ public function testResume()
8687
'totalSize' => '200',
8788
]);
8889

89-
$response = $this->createTestResponse($this->handler->handle($request));
90+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
9091
$response->assertSuccessful();
9192

9293
$response->assertJson([
@@ -128,7 +129,7 @@ public function testUploadFirstChunk()
128129
'HTTP_CONTENT_RANGE' => 'bytes 0-99/200',
129130
]);
130131

131-
$response = $this->createTestResponse($this->handler->handle($request));
132+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
132133
$response->assertSuccessful();
133134
$response->assertJson(['done' => 50]);
134135

@@ -168,7 +169,7 @@ public function testUploadLastChunk()
168169
'HTTP_CONTENT_RANGE' => 'bytes 100-199/200',
169170
]);
170171

171-
$response = $this->createTestResponse($this->handler->handle($request));
172+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
172173
$response->assertSuccessful();
173174
$response->assertJson(['done' => 100]);
174175

tests/Driver/DropzoneHandlerTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Http\UploadedFile;
1212
use Illuminate\Support\Facades\Event;
1313
use Illuminate\Support\Facades\Storage;
14+
use Illuminate\Testing\TestResponse;
1415
use Illuminate\Validation\ValidationException;
1516
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1617
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
@@ -65,7 +66,7 @@ public function testMethodNotAllowed($requestMethod)
6566

6667
$this->expectException(MethodNotAllowedHttpException::class);
6768

68-
$this->createTestResponse($this->handler->handle($request));
69+
TestResponse::fromBaseResponse($this->handler->handle($request));
6970
}
7071

7172
public function testUploadWhenFileParameterIsEmpty()
@@ -97,7 +98,7 @@ public function testUploadMonolith()
9798
'file' => $file,
9899
]);
99100

100-
$response = $this->createTestResponse($this->handler->handle($request));
101+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
101102
$response->assertSuccessful();
102103
$response->assertJson(['done' => 100]);
103104

@@ -179,7 +180,7 @@ public function testUploadFirstChunk()
179180
'file' => $file,
180181
]);
181182

182-
$response = $this->createTestResponse($this->handler->handle($request));
183+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
183184
$response->assertSuccessful();
184185
$response->assertJson(['done' => 50]);
185186

@@ -229,7 +230,7 @@ public function testUploadLastChunk()
229230
'file' => $file,
230231
]);
231232

232-
$response = $this->createTestResponse($this->handler->handle($request));
233+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
233234
$response->assertSuccessful();
234235
$response->assertJson(['done' => 100]);
235236

tests/Driver/FlowJsHandlerTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Http\UploadedFile;
1212
use Illuminate\Support\Facades\Event;
1313
use Illuminate\Support\Facades\Storage;
14+
use Illuminate\Testing\TestResponse;
1415
use Illuminate\Validation\ValidationException;
1516
use Symfony\Component\HttpFoundation\Response;
1617
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@@ -66,7 +67,7 @@ public function testMethodNotAllowed($requestMethod)
6667

6768
$this->expectException(MethodNotAllowedHttpException::class);
6869

69-
$this->createTestResponse($this->handler->handle($request));
70+
TestResponse::fromBaseResponse($this->handler->handle($request));
7071
}
7172

7273
public function testResumeWhenChunkDoesNotExists()
@@ -84,7 +85,7 @@ public function testResumeWhenChunkDoesNotExists()
8485
'flowCurrentChunkSize' => 100,
8586
]);
8687

87-
$response = $this->createTestResponse($this->handler->handle($request));
88+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
8889
$response->assertStatus(Response::HTTP_NO_CONTENT);
8990
}
9091

@@ -103,7 +104,7 @@ public function testResume()
103104
'flowCurrentChunkSize' => 100,
104105
]);
105106

106-
$response = $this->createTestResponse($this->handler->handle($request));
107+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
107108
$response->assertSuccessful();
108109
}
109110

@@ -187,7 +188,7 @@ public function testUploadFirstChunk()
187188
'file' => $file,
188189
]);
189190

190-
$response = $this->createTestResponse($this->handler->handle($request));
191+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
191192
$response->assertSuccessful();
192193
$response->assertJson(['done' => 50]);
193194

@@ -241,7 +242,7 @@ public function testUploadLastChunk()
241242
'file' => $file,
242243
]);
243244

244-
$response = $this->createTestResponse($this->handler->handle($request));
245+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
245246
$response->assertSuccessful();
246247
$response->assertJson(['done' => 100]);
247248

tests/Driver/MonolithHandlerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Http\UploadedFile;
1212
use Illuminate\Support\Facades\Event;
1313
use Illuminate\Support\Facades\Storage;
14+
use Illuminate\Testing\TestResponse;
1415
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1516
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
1617

@@ -63,7 +64,7 @@ public function testMethodNotAllowed($requestMethod)
6364

6465
$this->expectException(MethodNotAllowedHttpException::class);
6566

66-
$this->createTestResponse($this->handler->handle($request));
67+
TestResponse::fromBaseResponse($this->handler->handle($request));
6768
}
6869

6970
public function testUploadWhenFileParameterIsEmpty()
@@ -95,7 +96,7 @@ public function testUpload()
9596
'file' => $file,
9697
]);
9798

98-
$response = $this->createTestResponse($this->handler->handle($request));
99+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
99100
$response->assertSuccessful();
100101

101102
Storage::disk('local')->assertExists($file->hashName('merged'));

tests/Driver/NgFileHandlerTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Http\UploadedFile;
1212
use Illuminate\Support\Facades\Event;
1313
use Illuminate\Support\Facades\Storage;
14+
use Illuminate\Testing\TestResponse;
1415
use Illuminate\Validation\ValidationException;
1516
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1617
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
@@ -65,7 +66,7 @@ public function testMethodNotAllowed($requestMethod)
6566

6667
$this->expectException(MethodNotAllowedHttpException::class);
6768

68-
$this->createTestResponse($this->handler->handle($request));
69+
TestResponse::fromBaseResponse($this->handler->handle($request));
6970
}
7071

7172
public function testResumeWhenChunkDoesNotExists()
@@ -75,7 +76,7 @@ public function testResumeWhenChunkDoesNotExists()
7576
'totalSize' => '200',
7677
]);
7778

78-
$response = $this->createTestResponse($this->handler->handle($request));
79+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
7980
$response->assertSuccessful();
8081
$response->assertJson(['size' => 0]);
8182
}
@@ -89,7 +90,7 @@ public function testResume()
8990
'totalSize' => '200',
9091
]);
9192

92-
$response = $this->createTestResponse($this->handler->handle($request));
93+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
9394
$response->assertSuccessful();
9495
$response->assertJson(['size' => 100]);
9596
}
@@ -123,7 +124,7 @@ public function testUploadMonolith()
123124
'file' => $file,
124125
]);
125126

126-
$response = $this->createTestResponse($this->handler->handle($request));
127+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
127128
$response->assertSuccessful();
128129
$response->assertJson(['done' => 100]);
129130

@@ -200,7 +201,7 @@ public function testUploadFirstChunk()
200201
'file' => $file,
201202
]);
202203

203-
$response = $this->createTestResponse($this->handler->handle($request));
204+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
204205
$response->assertSuccessful();
205206
$response->assertJson(['done' => 50]);
206207

@@ -246,7 +247,7 @@ public function testUploadLastChunk()
246247
'file' => $file,
247248
]);
248249

249-
$response = $this->createTestResponse($this->handler->handle($request));
250+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
250251
$response->assertSuccessful();
251252
$response->assertJson(['done' => 100]);
252253

tests/Driver/PluploadHandlerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Http\UploadedFile;
1212
use Illuminate\Support\Facades\Event;
1313
use Illuminate\Support\Facades\Storage;
14+
use Illuminate\Testing\TestResponse;
1415
use Illuminate\Validation\ValidationException;
1516
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1617
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
@@ -66,7 +67,7 @@ public function testMethodNotAllowed($requestMethod)
6667

6768
$this->expectException(MethodNotAllowedHttpException::class);
6869

69-
$this->createTestResponse($this->handler->handle($request));
70+
TestResponse::fromBaseResponse($this->handler->handle($request));
7071
}
7172

7273
public function testUploadWhenFileParameterIsEmpty()
@@ -134,7 +135,7 @@ public function testUploadFirstChunk()
134135
'file' => $file,
135136
]);
136137

137-
$response = $this->createTestResponse($this->handler->handle($request));
138+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
138139
$response->assertSuccessful();
139140
$response->assertJson(['done' => 50]);
140141

@@ -178,7 +179,7 @@ public function testUploadLastChunk()
178179
'file' => $file,
179180
]);
180181

181-
$response = $this->createTestResponse($this->handler->handle($request));
182+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
182183
$response->assertSuccessful();
183184
$response->assertJson(['done' => 100]);
184185

tests/Driver/ResumableJsHandlerTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Http\UploadedFile;
1212
use Illuminate\Support\Facades\Event;
1313
use Illuminate\Support\Facades\Storage;
14+
use Illuminate\Testing\TestResponse;
1415
use Illuminate\Validation\ValidationException;
1516
use Symfony\Component\HttpFoundation\Response;
1617
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@@ -66,7 +67,7 @@ public function testMethodNotAllowed($requestMethod)
6667

6768
$this->expectException(MethodNotAllowedHttpException::class);
6869

69-
$this->createTestResponse($this->handler->handle($request));
70+
TestResponse::fromBaseResponse($this->handler->handle($request));
7071
}
7172

7273
public function testResumeWhenChunkDoesNotExists()
@@ -85,7 +86,7 @@ public function testResumeWhenChunkDoesNotExists()
8586
'resumableType' => 'text/plain',
8687
]);
8788

88-
$response = $this->createTestResponse($this->handler->handle($request));
89+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
8990
$response->assertStatus(Response::HTTP_NO_CONTENT);
9091
}
9192

@@ -105,7 +106,7 @@ public function testResume()
105106
'resumableType' => 'text/plain',
106107
]);
107108

108-
$response = $this->createTestResponse($this->handler->handle($request));
109+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
109110
$response->assertSuccessful();
110111
}
111112

@@ -192,7 +193,7 @@ public function testUploadFirstChunk()
192193
'file' => $file,
193194
]);
194195

195-
$response = $this->createTestResponse($this->handler->handle($request));
196+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
196197
$response->assertSuccessful();
197198
$response->assertJson(['done' => 50]);
198199

@@ -248,7 +249,7 @@ public function testUploadLastChunk()
248249
'file' => $file,
249250
]);
250251

251-
$response = $this->createTestResponse($this->handler->handle($request));
252+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
252253
$response->assertSuccessful();
253254
$response->assertJson(['done' => 100]);
254255

tests/Driver/SimpleUploaderJsHandlerTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Http\UploadedFile;
1212
use Illuminate\Support\Facades\Event;
1313
use Illuminate\Support\Facades\Storage;
14+
use Illuminate\Testing\TestResponse;
1415
use Illuminate\Validation\ValidationException;
1516
use Symfony\Component\HttpFoundation\Response;
1617
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@@ -66,7 +67,7 @@ public function testMethodNotAllowed($requestMethod)
6667

6768
$this->expectException(MethodNotAllowedHttpException::class);
6869

69-
$this->createTestResponse($this->handler->handle($request));
70+
TestResponse::fromBaseResponse($this->handler->handle($request));
7071
}
7172

7273
public function testResumeWhenChunkDoesNotExists()
@@ -84,7 +85,7 @@ public function testResumeWhenChunkDoesNotExists()
8485
'currentChunkSize' => 100,
8586
]);
8687

87-
$response = $this->createTestResponse($this->handler->handle($request));
88+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
8889
$response->assertStatus(Response::HTTP_NO_CONTENT);
8990
}
9091

@@ -103,7 +104,7 @@ public function testResume()
103104
'currentChunkSize' => 100,
104105
]);
105106

106-
$response = $this->createTestResponse($this->handler->handle($request));
107+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
107108
$response->assertSuccessful();
108109
}
109110

@@ -187,7 +188,7 @@ public function testUploadFirstChunk()
187188
'file' => $file,
188189
]);
189190

190-
$response = $this->createTestResponse($this->handler->handle($request));
191+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
191192
$response->assertSuccessful();
192193
$response->assertJson(['done' => 50]);
193194

@@ -241,7 +242,7 @@ public function testUploadLastChunk()
241242
'file' => $file,
242243
]);
243244

244-
$response = $this->createTestResponse($this->handler->handle($request));
245+
$response = TestResponse::fromBaseResponse($this->handler->handle($request));
245246
$response->assertSuccessful();
246247
$response->assertJson(['done' => 100]);
247248

tests/IdentityManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function setUp(): void
2424
$this->manager = new IdentityManager($this->app);
2525
}
2626

27-
public function availableDrivers()
27+
public static function availableDrivers()
2828
{
2929
return [
3030
'auth' => ['auth', AuthIdentifier::class],

tests/Range/NgFileUploadRangeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class NgFileUploadRangeTest extends TestCase
1212
{
13-
public function invalidArgumentProvider()
13+
public static function invalidArgumentProvider()
1414
{
1515
return [
1616
'Chunk number less than zero' => [-1, 10, 10, 100, '`_chunkNumber` must be greater than or equal to zero'],

0 commit comments

Comments
 (0)