Skip to content

Commit 36851fb

Browse files
authored
Merge pull request #81 from nerg4l/feature/laravel-11
feat: Laravel 11 support
2 parents d442d03 + 2e8205b commit 36851fb

18 files changed

+111
-76
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
php: [ 8.0, 8.1, 8.2 ]
19-
laravel: [ '^9.0', '^10.0' ]
18+
php: [ 8.0, 8.1, 8.2, 8.3 ]
19+
laravel: [ '^9.0', '^10.0', '^11.0' ]
2020
dependency-version: [prefer-lowest, prefer-stable]
2121
exclude:
22-
- php: 8.0
23-
laravel: '^10.0'
22+
- laravel: '^9.0'
23+
php: 8.3
24+
- laravel: '^10.0'
25+
php: 8.0
26+
- laravel: '^11.0'
27+
php: 8.0
28+
- laravel: '^11.0'
29+
php: 8.1
2430

2531
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-version }}
2632

@@ -29,10 +35,10 @@ jobs:
2935
run: sudo apt-get update --fix-missing
3036

3137
- name: Checkout code
32-
uses: actions/checkout@v3
38+
uses: actions/checkout@v4
3339

3440
- name: Cache dependencies
35-
uses: actions/cache@v3
41+
uses: actions/cache@v4
3642
with:
3743
path: ~/.composer/cache/files
3844
key: laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
@@ -42,7 +48,7 @@ jobs:
4248
with:
4349
php-version: ${{ matrix.php }}
4450
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
45-
coverage: none
51+
coverage: xdebug
4652

4753
- name: Validate composer.json
4854
run: composer validate
@@ -53,4 +59,4 @@ jobs:
5359
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
5460
5561
- name: Execute tests
56-
run: vendor/bin/phpunit --verbose
62+
run: vendor/bin/phpunit

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
],
1616
"require": {
1717
"php": "^8.0",
18-
"illuminate/support": "^9.0 || ^10.0",
19-
"illuminate/http": "^9.0 || ^10.0"
18+
"illuminate/support": "^9.0 || ^10.0 || ^11.0",
19+
"illuminate/http": "^9.0 || ^10.0 || ^11.0"
2020
},
2121
"require-dev": {
22-
"orchestra/testbench": "^7.3 || ^8.0",
23-
"phpunit/phpunit": "^9.5"
22+
"orchestra/testbench": "^7.3 || ^8.0 || ^9.0",
23+
"phpunit/phpunit": "^9.5 || ^10.5"
2424
},
2525
"autoload": {
2626
"psr-4": {

phpunit.xml.dist

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
verbose="true">
7-
<coverage>
8-
<include>
9-
<directory suffix=".php">src/</directory>
10-
</include>
11-
<report>
12-
<clover outputFile="build/logs/clover.xml"/>
13-
</report>
14-
</coverage>
15-
<testsuites>
16-
<testsuite name="Laravel Upload Handler Test Suite">
17-
<directory>tests</directory>
18-
</testsuite>
19-
</testsuites>
20-
<logging>
21-
<junit outputFile="build/report.junit.xml"/>
22-
<text outputFile="build/coverage.txt"/>
23-
</logging>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache">
3+
<coverage>
4+
<report>
5+
<clover outputFile="build/logs/clover.xml"/>
6+
</report>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Laravel Upload Handler Test Suite">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
<logging>
14+
<junit outputFile="build/report.junit.xml"/>
15+
</logging>
16+
<source>
17+
<include>
18+
<directory suffix=".php">src/</directory>
19+
</include>
20+
</source>
2421
</phpunit>

phpunit.xml.dist.bak

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
verbose="true">
7+
<coverage>
8+
<include>
9+
<directory suffix=".php">src/</directory>
10+
</include>
11+
<report>
12+
<clover outputFile="build/logs/clover.xml"/>
13+
</report>
14+
</coverage>
15+
<testsuites>
16+
<testsuite name="Laravel Upload Handler Test Suite">
17+
<directory>tests</directory>
18+
</testsuite>
19+
</testsuites>
20+
<logging>
21+
<junit outputFile="build/report.junit.xml"/>
22+
<text outputFile="build/coverage.txt"/>
23+
</logging>
24+
</phpunit>

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

0 commit comments

Comments
 (0)