Skip to content

Commit a3e0392

Browse files
committed
Merge branch 'release/2.0.0'
2 parents 9d156bf + b56be96 commit a3e0392

13 files changed

+34
-57
lines changed

.github/workflows/tests.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php: [7.4, '8.0', 8.1, 8.2]
18-
laravel: [8, 9]
19-
exclude:
20-
- php: 7.4
21-
laravel: 9
17+
php: [8.1, 8.2]
18+
laravel: [10]
2219

2320
steps:
2421
- name: Checkout Code

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file. This project adheres to
44
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).
55

6+
## [2.0.0] - 2023-02-14
7+
8+
### Changed
9+
10+
- Upgraded to Laravel 10 and set minimum PHP version to 8.1.
11+
612
## [1.1.1] - 2022-09-14
713

814
### Fixed

composer.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
}
2424
],
2525
"require": {
26-
"php": "^7.4|^8.0",
26+
"php": "^8.1",
2727
"ext-json": "*",
28-
"illuminate/contracts": "^8.0|^9.0",
29-
"illuminate/pipeline": "^8.0|^9.0",
30-
"laravel-json-api/core": "^1.0|^2.0",
31-
"laravel-json-api/validation": "^1.0|^2.0"
28+
"illuminate/contracts": "^10.0",
29+
"illuminate/pipeline": "^10.0",
30+
"laravel-json-api/core": "^3.0",
31+
"laravel-json-api/validation": "^3.0"
3232
},
3333
"require-dev": {
34-
"laravel-json-api/testing": "^1.1",
35-
"orchestra/testbench": "^6.23|^7.0",
36-
"phpunit/phpunit": "^9.5.10"
34+
"laravel-json-api/testing": "^2.0",
35+
"orchestra/testbench": "^8.0",
36+
"phpunit/phpunit": "^9.5.28"
3737
},
3838
"autoload": {
3939
"psr-4": {
@@ -47,11 +47,11 @@
4747
},
4848
"extra": {
4949
"branch-alias": {
50-
"dev-develop": "1.x-dev"
50+
"dev-develop": "2.x-dev"
5151
}
5252
},
5353
"minimum-stability": "stable",
54-
"prefer-stable": false,
54+
"prefer-stable": true,
5555
"config": {
5656
"sort-packages": true
5757
}

src/ExceptionParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

src/Pipes/AuthenticationExceptionHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

src/Pipes/Concerns/SetsHttpTitle.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

src/Pipes/HttpExceptionHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

src/Pipes/RequestExceptionHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

src/Pipes/ValidationExceptionHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/Integration/AcceptHeaderTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/Integration/ExceptionsTest.php

+7-33
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -19,11 +19,9 @@
1919

2020
namespace LaravelJsonApi\Exceptions\Tests\Integration;
2121

22-
use Carbon\Carbon;
2322
use Illuminate\Auth\Access\AuthorizationException;
2423
use Illuminate\Auth\AuthenticationException;
2524
use Illuminate\Contracts\Translation\Translator;
26-
use Illuminate\Foundation\Http\Exceptions\MaintenanceModeException;
2725
use Illuminate\Session\TokenMismatchException;
2826
use Illuminate\Support\Arr;
2927
use Illuminate\Support\Collection;
@@ -62,8 +60,7 @@ public function testNotFound(): void
6260
$expected = [
6361
'errors' => [
6462
[
65-
// @TODO added in Laravel 9
66-
// 'detail' => 'The route foobar could not be found.',
63+
'detail' => 'The route foobar could not be found.',
6764
'status' => '404',
6865
'title' => 'Not Found',
6966
],
@@ -76,16 +73,15 @@ public function testNotFound(): void
7673
$this->get('/foobar', ['Accept' => 'application/vnd.api+json'])
7774
->assertStatus(404)
7875
->assertHeader('Content-Type', 'application/vnd.api+json')
79-
->assertJson($expected); // @TODO revert to `assertExactJson` when using only Laravel 9
76+
->assertExactJson($expected);
8077
}
8178

8279
public function testMethodNotAllowed(): void
8380
{
8481
$expected = [
8582
'errors' => [
8683
[
87-
// @TODO detail has changed in Laravel 9
88-
// 'detail' => 'The POST method is not supported for this route. Supported methods: GET, HEAD.',
84+
'detail' => 'The POST method is not supported for route test. Supported methods: GET, HEAD.',
8985
'status' => '405',
9086
'title' => 'Method Not Allowed',
9187
],
@@ -98,7 +94,7 @@ public function testMethodNotAllowed(): void
9894
$this->post('/test', [], ['Accept' => 'application/vnd.api+json'])
9995
->assertStatus(405)
10096
->assertHeader('Content-Type', 'application/vnd.api+json')
101-
->assertJson($expected); // @TODO revert back to `assertExactJson`
97+
->assertExactJson($expected);
10298
}
10399

104100
/**
@@ -158,34 +154,12 @@ public function testJsonApiException(): void
158154

159155
public function testMaintenanceMode(): void
160156
{
161-
$this->ex = new MaintenanceModeException(Carbon::now()->getTimestamp(), 60, "We'll be back soon.");
162-
163-
$expected = [
164-
'errors' => [
165-
[
166-
'title' => 'Service Unavailable',
167-
'detail' => "We'll be back soon.",
168-
'status' => '503',
169-
],
170-
],
171-
'jsonapi' => [
172-
'version' => '1.0',
173-
],
174-
];
175-
176-
$this->get('/test', ['Accept' => 'application/vnd.api+json'])
177-
->assertStatus(503)
178-
->assertHeader('Content-Type', 'application/vnd.api+json')
179-
->assertExactJson($expected);
180-
}
181-
182-
public function testMaintenanceModeWithoutMessage(): void
183-
{
184-
$this->ex = new MaintenanceModeException(Carbon::now()->getTimestamp(), 60, '');
157+
$this->ex = new HttpException(503, 'We are down for maintenance.');
185158

186159
$expected = [
187160
'errors' => [
188161
[
162+
'detail' => 'We are down for maintenance.',
189163
'title' => 'Service Unavailable',
190164
'status' => '503',
191165
],

tests/Integration/Handler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/Integration/TestCase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2022 Cloud Creativity Limited
3+
* Copyright 2023 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)