Skip to content

Commit d164e4e

Browse files
YannikFirrenerg4l
authored andcommitted
UPDATED - laravel 8 upgraded & < 7 dropped
1 parent fbab973 commit d164e4e

13 files changed

+93
-98
lines changed

.github/workflows/test.yml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test
1+
name: run-tests
22

33
on:
44
push:
@@ -9,35 +9,50 @@ on:
99
- 'master'
1010

1111
jobs:
12-
build:
13-
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
12+
test:
1413
runs-on: ubuntu-latest
14+
1515
strategy:
16-
fail-fast: true
16+
fail-fast: false
1717
matrix:
18-
php: [ '7.2', '7.3', '7.4' ]
19-
laravel: [ '5.5.*', '5.6.*', '5.7.*', '5.8.*', '^6.0', '^7.0' ]
18+
php: [ 7.4, 7.3 ]
19+
laravel: [ 8.*, 7.* ]
20+
dependency-version: [prefer-lowest, prefer-stable]
21+
include:
22+
- laravel: 7.*
23+
testbench: 5.*
24+
- laravel: 8.*
25+
testbench: 6.*
26+
27+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
2028

2129
steps:
22-
- uses: actions/checkout@v2
30+
- name: Update apt
31+
run: sudo apt-get update --fix-missing
32+
33+
- name: Checkout code
34+
uses: actions/checkout@v2
2335

24-
- uses: actions/cache@v1
36+
- name: Cache dependencies
37+
uses: actions/cache@v2
2538
with:
2639
path: ~/.composer/cache/files
27-
key: laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
40+
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
2841

29-
- uses: shivammathur/setup-php@v1
42+
- name: Setup PHP
43+
uses: shivammathur/setup-php@v2
3044
with:
3145
php-version: ${{ matrix.php }}
46+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
3247
coverage: none
3348

3449
- name: Validate composer.json
3550
run: composer validate
3651

3752
- name: Install dependencies
3853
run: |
39-
composer require "illuminate/support:${{ matrix.laravel }}" "illuminate/http:${{ matrix.laravel }}" --no-interaction --no-update
40-
composer update --prefer-dist --no-interaction --no-suggest
54+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
55+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
4156
42-
- name: Run test
43-
run: ./vendor/bin/phpunit --verbose
57+
- name: Execute tests
58+
run: vendor/bin/phpunit

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^7.1",
18-
"illuminate/support": "^5.5 || ^6.0 || ^7.0",
19-
"illuminate/http": "^5.5 || ^6.0 || ^7.0"
17+
"php": "^7.3",
18+
"illuminate/support": "^7.0 || ^8.0",
19+
"illuminate/http": "^7.0 || ^8.0"
2020
},
2121
"require-dev": {
22-
"orchestra/testbench": "^3.5 || ^4.0 || ^5.0",
23-
"phpunit/phpunit": "^6.0 || ^7.0 || ^8.0",
24-
"mockery/mockery": "^1.0"
22+
"orchestra/testbench": "^5.0 || ^6.0",
23+
"phpunit/phpunit": "^9.1",
24+
"mockery/mockery": "^1.3"
2525
},
2626
"autoload": {
2727
"psr-4": {

phpunit.xml.dist

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
beStrictAboutTestsThatDoNotTestAnything="true"
5-
beStrictAboutOutputDuringTests="true"
6-
bootstrap="vendor/autoload.php"
7-
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
failOnRisky="true"
12-
failOnWarning="true"
13-
processIsolation="false"
14-
stopOnError="false"
15-
stopOnFailure="false"
16-
verbose="true"
17-
>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">src/</directory>
6+
</include>
7+
</coverage>
188
<testsuites>
199
<testsuite name="Laravel Upload Handler Test Suite">
20-
<directory>./tests</directory>
10+
<directory>tests</directory>
2111
</testsuite>
2212
</testsuites>
23-
<filter>
24-
<whitelist processUncoveredFilesFromWhitelist="true">
25-
<directory suffix=".php">./src</directory>
26-
</whitelist>
27-
</filter>
28-
<logging>
29-
<log type="tap" target="build/report.tap"/>
30-
<log type="junit" target="build/report.junit.xml"/>
31-
<log type="coverage-text" target="build/coverage.txt"/>
32-
<log type="coverage-clover" target="build/logs/clover.xml"/>
33-
</logging>
3413
</phpunit>

src/IdentityManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function createNopDriver()
3131
*/
3232
public function getDefaultDriver()
3333
{
34-
return $this->app['config']['upload-handler.identifier'];
34+
return $this->container['config']['upload-handler.identifier'];
3535
}
3636

3737
/**
@@ -43,6 +43,6 @@ public function getDefaultDriver()
4343
*/
4444
public function setDefaultDriver($name)
4545
{
46-
$this->app['config']['upload-handler.identifier'] = $name;
46+
$this->container['config']['upload-handler.identifier'] = $name;
4747
}
4848
}

src/UploadManager.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ class UploadManager extends Manager
1616
{
1717
public function createMonolithDriver()
1818
{
19-
return new MonolithBaseHandler($this->app['config']['upload-handler.monolith']);
19+
return new MonolithBaseHandler($this->container['config']['upload-handler.monolith']);
2020
}
2121

2222
public function createBlueimpDriver()
2323
{
2424
/** @var \Illuminate\Support\Manager $identityManager */
25-
$identityManager = $this->app['upload-handler.identity-manager'];
25+
$identityManager = $this->container['upload-handler.identity-manager'];
2626

27-
return new BlueimpBaseHandler($this->app['config']['upload-handler.blueimp'], $identityManager->driver());
27+
return new BlueimpBaseHandler($this->container['config']['upload-handler.blueimp'], $identityManager->driver());
2828
}
2929

3030
public function createDropzoneDriver()
3131
{
32-
return new DropzoneBaseHandler($this->app['config']['upload-handler.dropzone']);
32+
return new DropzoneBaseHandler($this->container['config']['upload-handler.dropzone']);
3333
}
3434

3535
public function createFlowJsDriver()
3636
{
37-
return new FlowJsHandler($this->app['config']['upload-handler.resumable-js'], $this->identityManager()->driver());
37+
return new FlowJsHandler($this->container['config']['upload-handler.resumable-js'], $this->identityManager()->driver());
3838
}
3939

4040
public function createNgFileUploadDriver()
@@ -49,20 +49,20 @@ public function createPluploadDriver()
4949

5050
public function createResumableJsDriver()
5151
{
52-
return new ResumableJsBaseHandler($this->app['config']['upload-handler.resumable-js'], $this->identityManager()->driver());
52+
return new ResumableJsBaseHandler($this->container['config']['upload-handler.resumable-js'], $this->identityManager()->driver());
5353
}
5454

5555
public function createSimpleUploaderJsDriver()
5656
{
57-
return new SimpleUploaderJsHandler($this->app['config']['upload-handler.simple-uploader-js'], $this->identityManager()->driver());
57+
return new SimpleUploaderJsHandler($this->container['config']['upload-handler.simple-uploader-js'], $this->identityManager()->driver());
5858
}
5959

6060
/**
6161
* @return \Illuminate\Support\Manager
6262
*/
6363
protected function identityManager()
6464
{
65-
return $this->app['upload-handler.identity-manager'];
65+
return $this->container['upload-handler.identity-manager'];
6666
}
6767

6868
/**
@@ -72,7 +72,7 @@ protected function identityManager()
7272
*/
7373
public function getDefaultDriver()
7474
{
75-
return $this->app['config']['upload-handler.handler'];
75+
return $this->container['config']['upload-handler.handler'];
7676
}
7777

7878
/**
@@ -84,6 +84,6 @@ public function getDefaultDriver()
8484
*/
8585
public function setDefaultDriver($name)
8686
{
87-
$this->app['config']['upload-handler.handler'] = $name;
87+
$this->container['config']['upload-handler.handler'] = $name;
8888
}
8989
}

tests/Driver/BlueimpUploadHandlerTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ protected function setUp(): void
2828
{
2929
parent::setUp();
3030

31-
$this->app->make('config')->set('upload-handler.identifier', 'nop');
32-
$this->app->make('config')->set('upload-handler.handler', 'blueimp');
33-
$this->app->make('config')->set('upload-handler.sweep', false);
34-
$this->handler = $this->app->make(UploadHandler::class);
31+
config()->set('upload-handler.identifier', 'nop');
32+
config()->set('upload-handler.handler', 'blueimp');
33+
config()->set('upload-handler.sweep', false);
34+
$this->handler = app()->make(UploadHandler::class);
3535

3636
Storage::fake('local');
3737
Event::fake();
3838
}
3939

4040
public function testDriverInstance()
4141
{
42-
$manager = $this->app->make('upload-handler.upload-manager');
42+
$manager = app()->make('upload-handler.upload-manager');
4343

4444
$this->assertInstanceOf(BlueimpBaseHandler::class, $manager->driver());
4545
}
@@ -120,7 +120,8 @@ public function testUploadWhenFileParameterIsEmpty()
120120

121121
public function testUploadWhenFileParameterIsInvalid()
122122
{
123-
$file = Mockery::mock(UploadedFile::class)->makePartial();
123+
$file = Mockery::mock(UploadedFile::class)
124+
->makePartial();
124125
$file->shouldReceive('isValid')
125126
->andReturn(false);
126127

tests/Driver/DropzoneUploadHandlerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ protected function setUp(): void
2626
{
2727
parent::setUp();
2828

29-
$this->app->make('config')->set('upload-handler.handler', 'dropzone');
30-
$this->app->make('config')->set('upload-handler.sweep', false);
31-
$this->handler = $this->app->make(UploadHandler::class);
29+
config()->set('upload-handler.handler', 'dropzone');
30+
config()->set('upload-handler.sweep', false);
31+
$this->handler = app()->make(UploadHandler::class);
3232

3333
Storage::fake('local');
3434
Event::fake();
3535
}
3636

3737
public function testDriverInstance()
3838
{
39-
$manager = $this->app->make('upload-handler.upload-manager');
39+
$manager = app()->make('upload-handler.upload-manager');
4040

4141
$this->assertInstanceOf(DropzoneBaseHandler::class, $manager->driver());
4242
}

tests/Driver/FlowJsUploadHandlerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ protected function setUp(): void
2828
{
2929
parent::setUp();
3030

31-
$this->app->make('config')->set('upload-handler.identifier', 'nop');
32-
$this->app->make('config')->set('upload-handler.handler', 'flow-js');
33-
$this->app->make('config')->set('upload-handler.sweep', false);
34-
$this->handler = $this->app->make(UploadHandler::class);
31+
config()->set('upload-handler.identifier', 'nop');
32+
config()->set('upload-handler.handler', 'flow-js');
33+
config()->set('upload-handler.sweep', false);
34+
$this->handler = app()->make(UploadHandler::class);
3535

3636
Storage::fake('local');
3737
Event::fake();
3838
}
3939

4040
public function testDriverInstance()
4141
{
42-
$manager = $this->app->make('upload-handler.upload-manager');
42+
$manager = app()->make('upload-handler.upload-manager');
4343

4444
$this->assertInstanceOf(FlowJsHandler::class, $manager->driver());
4545
}

tests/Driver/MonolithUploadHandlerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ protected function setUp(): void
2828
{
2929
parent::setUp();
3030

31-
$this->app->make('config')->set('upload-handler.handler', 'monolith');
32-
$this->handler = $this->app->make(UploadHandler::class);
31+
config()->set('upload-handler.handler', 'monolith');
32+
$this->handler = app()->make(UploadHandler::class);
3333

3434
Storage::fake('local');
3535
Event::fake();
3636
}
3737

3838
public function testDriverInstance()
3939
{
40-
$manager = $this->app->make('upload-handler.upload-manager');
40+
$manager = app()->make('upload-handler.upload-manager');
4141

4242
$this->assertInstanceOf(MonolithBaseHandler::class, $manager->driver());
4343
}

tests/Driver/NgFileUploadHandlerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ protected function setUp(): void
2727
{
2828
parent::setUp();
2929

30-
$this->app->make('config')->set('upload-handler.identifier', 'nop');
31-
$this->app->make('config')->set('upload-handler.handler', 'ng-file-upload');
32-
$this->app->make('config')->set('upload-handler.sweep', false);
33-
$this->handler = $this->app->make(UploadHandler::class);
30+
config()->set('upload-handler.identifier', 'nop');
31+
config()->set('upload-handler.handler', 'ng-file-upload');
32+
config()->set('upload-handler.sweep', false);
33+
$this->handler = app()->make(UploadHandler::class);
3434

3535
Storage::fake('local');
3636
Event::fake();
3737
}
3838

3939
public function testDriverInstance()
4040
{
41-
$manager = $this->app->make('upload-handler.upload-manager');
41+
$manager = app()->make('upload-handler.upload-manager');
4242

4343
$this->assertInstanceOf(NgFileBaseHandler::class, $manager->driver());
4444
}

0 commit comments

Comments
 (0)