8000 [Feature] Support Laravel 9 · isabella232/laravel-json-api@31e5fdb · GitHub
[go: up one dir, main page]

Skip to content

Commit 31e5fdb

Browse files
committed
[Feature] Support Laravel 9
1 parent a9b528d commit 31e5fdb

File tree

9 files changed

+56
-31
lines changed

9 files changed

+56
-31
lines changed

.github/workflows/tests.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
php: [7.4, '8.0', 8.1]
18+
laravel: [8.76, 9]
19+
exclude:
20+
- php: 7.4
21+
laravel: 9
22+
23+
steps:
24+
- name: Checkout Code
25+
uses: actions/checkout@v2
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php }}
31+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
32+
tools: composer:v2
33+
coverage: none
34+
ini-values: error_reporting=E_ALL
35+
36+
- name: Set Laravel Version
37+
run: composer require "laravel/framework:^${{ matrix.laravel }}" --no-update
38+
39+
- name: Install dependencies
40+
uses: nick-invision/retry@v1
41+
with:
42+
timeout_minutes: 5
43+
max_attempts: 5
44+
command: composer update --prefer-dist --no-interaction --no-progress
45+
46+
- name: Execute tests
47+
run: vendor/bin/phpunit

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. This projec
77
### Added
88

99
- Package now supports PHP 8.
10+
- Package now supports Laravel 9.
1011

1112
### Changed
1213

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"php": "^7.4|^8.0",
2626
"ext-json": "*",
2727
"laravel-json-api/neomerx-json-api": "^1.1",
28-
"laravel/framework": "^8.76",
28+
"laravel/framework": "^8.76|^9.0",
2929
"nyholm/psr7": "^1.2",
3030
"ramsey/uuid": "^3.0|^4.0",
3131
"symfony/psr-http-message-bridge": "^2.0"
@@ -37,7 +37,7 @@
3737
"laravel/legacy-factories": "^1.0.4",
3838
"laravel/ui": "^3.0",
3939
"mockery/mockery": "^1.1",
40-
"orchestra/testbench": "^6.23",
40+
"orchestra/testbench": "^6.23|^7.0",
4141
"phpunit/phpunit": "^9.5.10"
4242
},
4343
"suggest": {

src/Exceptions/JsonApiException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct($errors, Throwable $previous = null, array $headers
6868
/**
6969
* @inheritDoc
7070
*/
71-
public function getStatusCode()
71+
public function getStatusCode(): int
7272
{
7373
return $this->errors->getStatus();
7474
}
@@ -87,7 +87,7 @@ public function withHeaders(array $headers): self
8787
/**
8888
* @inheritDoc
8989
*/
90-
public function getHeaders()
90+
public function getHeaders(): array
9191
{
9292
return $this->headers;
9393
}

tests/dummy/tests/Feature/Avatars/CreateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CreateTest extends TestCase
3636
public function test(string $contentType): void
3737
{
3838
$user = factory(User::class)->create();
39-
$file = UploadedFile::fake()->create('avatar.jpg');
39+
$file = UploadedFile::fake()->image('avatar.jpg');
4040

4141
$expected = [
4242
'type' => 'avatars',

tests/dummy/tests/Feature/Avatars/ReadTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testDownload(): void
4343
{
4444
Storage::fake('local');
4545

46-
$path = UploadedFile::fake()->create('avatar.jpg')->store('avatars');
46+
$path = UploadedFile::fake()->image('avatar.jpg')->store('avatars');
4747
$avatar = factory(Avatar::class)->create(compact('path'));
4848

4949
$this->withAcceptMediaType('image/*')

tests/dummy/tests/Feature/Avatars/UpdateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function setUp(): void
4848
*/
4949
public function test(string $contentType): void
5050
{
51-
$file = UploadedFile::fake()->create('avatar.jpg');
51+
$file = UploadedFile::fake()->image('avatar.jpg');
5252

5353
$expected = [
5454
'type' => 'avatars',

tests/lib/Unit/ContainerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use CloudCreativity\LaravelJsonApi\Contracts\Validation\ValidatorFactoryInterface;
2525
use CloudCreativity\LaravelJsonApi\Exceptions\RuntimeException;
2626
use Illuminate\Container\Container as IlluminateContainer;
27-
use League\Flysystem\AdapterInterface;
2827
use Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface;
2928
use PHPUnit\Framework\MockObject\MockObject;
3029

@@ -253,7 +252,7 @@ public function testResourceAuthorizerForInvalidResourceType()
253252

254253
public function testResourceAuthorizerIsNotResourceAuthorizer()
255254
{
256-
$mock = $this->createMock(AdapterInterface::class);
255+
$mock = $this->createMock(\Illuminate\Contracts\Container\Container::class);
257256
$this->resolver->method('getAuthorizerByResourceType')->willReturn(get_class($mock));
258257
$this->illuminateContainer->method('make')->willReturn($mock);
259258

0 commit comments

Comments
 (0)
0