Skip to content

Commit fbb12bd

Browse files
committed
Merge branch 'release/1.0.0-beta.4' into main
2 parents 3fde242 + 6314b0c commit fbb12bd

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
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+
## [1.0.0-beta.4] - 2021-06-02
7+
8+
### Fixed
9+
10+
- [#76](https://github.com/laravel-json-api/laravel/issues/76) Pagination links will now be correctly added to related
11+
resources and relationship identifiers responses.
12+
613
## [1.0.0-beta.3] - 2021-04-26
714

815
### Added

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"require": {
2626
"php": "^7.4|^8.0",
2727
"ext-json": "*",
28-
"laravel-json-api/core": "^1.0.0-beta.3",
29-
"laravel-json-api/eloquent": "^1.0.0-beta.4",
28+
"laravel-json-api/core": "^1.0.0-beta.4",
29+
"laravel-json-api/eloquent": "^1.0.0-beta.5",
3030
"laravel-json-api/encoder-neomerx": "^1.0.0-beta.1",
3131
"laravel-json-api/exceptions": "^1.0.0-beta.2",
3232
"laravel-json-api/spec": "^1.0.0-beta.1",

tests/dummy/tests/Api/V1/Posts/ReadCommentIdentifiersTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use App\Models\Comment;
2323
use App\Models\Post;
2424
use App\Tests\Api\V1\TestCase;
25+
use Illuminate\Support\Arr;
2526

2627
class ReadCommentIdentifiersTest extends TestCase
2728
{
@@ -102,6 +103,12 @@ public function testPaginated(): void
102103
'to' => 3,
103104
'total' => 5,
104105
],
106+
])->assertLinks([
107+
'first' => $self . '?' . Arr::query(['page' => ['number' => 1, 'size' => 3], 'sort' => 'id']),
108+
'last' => $self . '?' . Arr::query(['page' => ['number' => 2, 'size' => 3], 'sort' => 'id']),
109+
'next' => $self . '?' . Arr::query(['page' => ['number' => 2, 'size' => 3], 'sort' => 'id']),
110+
'related' => url('/api/v1/posts', [$this->post, 'comments']),
111+
'self' => $self,
105112
]);
106113
}
107114

tests/dummy/tests/Api/V1/Posts/ReadCommentsTest.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use App\Models\Comment;
2323
use App\Models\Post;
2424
use App\Tests\Api\V1\TestCase;
25+
use Illuminate\Support\Arr;
2526

2627
class ReadCommentsTest extends TestCase
2728
{
@@ -78,7 +79,7 @@ public function testPaginated(): void
7879
->jsonApi('comments')
7980
->page(['number' => '1', 'size' => '3'])
8081
->sort('id')
81-
->get(url('/api/v1/posts', [$this->post, 'comments']));
82+
->get($url = url('/api/v1/posts', [$this->post, 'comments']));
8283

8384
$response->assertFetchedMany($expected)->assertExactMeta([
8485
'count' => 5,
@@ -90,6 +91,10 @@ public function testPaginated(): void
9091
'to' => 3,
9192
'total' => 5,
9293
],
94+
])->assertLinks([
95+
'first' => $url . '?' . Arr::query(['page' => ['number' => 1, 'size' => 3], 'sort' => 'id']),
96+
'last' => $url . '?' . Arr::query(['page' => ['number' => 2, 'size' => 3], 'sort' => 'id']),
97+
'next' => $url . '?' . Arr::query(['page' => ['number' => 2, 'size' => 3], 'sort' => 'id']),
9398
]);
9499
}
95100

0 commit comments

Comments
 (0)