Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 8.2, 8.3, 8.4, 8.5 ]
laravel: [ 11, 12, 13 ]
php: [ 8.2, 8.3, 8.4, 8.5, 8.6 ]
laravel: [ 12, 13 ]
exclude:
- laravel: 13
php: 8.2
- laravel: 11
php: 8.5
- laravel: 12
php: 8.6

steps:
- name: Checkout Code
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. This projec

## Unreleased

### Changed

- Dropped support for Laravel 11, which is end-of-life and no longer supported for security fixes.

## [7.3.0] - 2026-03-30

### Added
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
"php": "^8.2",
"ext-json": "*",
"laravel-json-api/neomerx-json-api": "^5.0.3",
"laravel/framework": "^11.0|^12.0|^13.0",
"laravel/framework": "^12.71|^13.2",
"nyholm/psr7": "^1.8",
"ramsey/uuid": "^4.0",
"symfony/psr-http-message-bridge": "^7.0"
},
"require-dev": {
"ext-sqlite3": "*",
"guzzlehttp/guzzle": "^7.8",
"laravel-json-api/testing": "^3.2",
"guzzlehttp/guzzle": "^7.15.2",
"laravel-json-api/testing": "^3.3",
"laravel/legacy-factories": "^1.4.0",
"laravel/ui": "^4.6",
"mockery/mockery": "^1.6",
"orchestra/testbench": "^9.0|^10.0|^11.0",
"phpunit/phpunit": "^10.5|^11.0"
"orchestra/testbench": "^10.12|^11.3",
"phpunit/phpunit": "^10.5|^11.5"
},
"suggest": {
"cloudcreativity/json-api-testing": "Required to use the test helpers."
Expand Down
4 changes: 2 additions & 2 deletions src/Document/Link/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function fromArray(array $input): self
* @param string $href
* @param array|null $meta
*/
public function __construct(string $href, array $meta = null)
public function __construct(string $href, ?array $meta = null)
{
$this->setHref($href);
$this->setMeta($meta);
Expand Down Expand Up @@ -132,7 +132,7 @@ public function toArray()
/**
* @inheritDoc
*/
public function jsonSerialize()
public function jsonSerialize(): mixed
{
if ($this->hasMeta()) {
return $this->toArray();
Expand Down
2 changes: 1 addition & 1 deletion src/Eloquent/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function addScopes(Scope ...$scopes): self
*/
public function addClosureScope(Closure $scope, ?string $identifier = null): self
{
$identifier = $identifier ?: spl_object_hash($scope);
$identifier = $identifier ?: strval(spl_object_id($scope));

$this->scopes[$identifier] = $scope;

Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Integration/Client/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function willSeeResponse(?array $json = null, $status = 200, array $he
if ($json) {
$body = json_encode($json);
$headers['Content-Type'] = 'application/vnd.api+json';
$headers['Content-Length'] = mb_strlen($body, '8bit');
$headers['Content-Length'] = (string) mb_strlen($body, '8bit');
} else {
$body = null;
}
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/Integration/ErrorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,12 @@ public function testInvalidJson()
$uri = '/api/v1/posts';
$content = '{"data": {}';

$this->doInvalidRequest($uri, $content)->assertStatus(400)->assertExactJson([
$this->doInvalidRequest($uri, $content)->assertStatus(400)->assertJson([
'errors' => [
[
'title' => 'Invalid JSON',
'code' => '4',
'status' => '400',
'detail' => 'Syntax error',
],
],
]);
Expand Down
43 changes: 43 additions & 0 deletions tests/lib/Unit/Document/LinkTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace CloudCreativity\LaravelJsonApi\Tests\Unit\Document;

use CloudCreativity\LaravelJsonApi\Document\Link\Link;
use CloudCreativity\LaravelJsonApi\Tests\Unit\TestCase;

class LinkTest extends TestCase
{
public function testLinkWithoutMetadata(): void
{
$url = 'https://example.test/leads/123';

$link = new Link($url);

$this->assertNull($link->getMeta());
$this->assertSame($url, $link->jsonSerialize());
$this->assertSame(
json_encode($url, JSON_THROW_ON_ERROR),
json_encode($link, JSON_THROW_ON_ERROR)
);
}

public function testLinkWithMetadata(): void
{
$url = 'https://example.test/leads/123';
$meta = ['source' => 'test'];

$link = new Link($url, $meta);

$expected = [
'href' => $url,
'meta' => $meta,
];

$this->assertSame($meta, $link->getMeta());
$this->assertSame($expected, $link->jsonSerialize());
$this->assertSame(
json_encode($expected, JSON_THROW_ON_ERROR),
json_encode($link, JSON_THROW_ON_ERROR)
);
}
}