diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 63e39381..314d167a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b1238d..e1a2c4bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/composer.json b/composer.json index dd721ce4..eec57a6c 100644 --- a/composer.json +++ b/composer.json @@ -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." diff --git a/src/Document/Link/Link.php b/src/Document/Link/Link.php index bd2ca888..c7b81a81 100644 --- a/src/Document/Link/Link.php +++ b/src/Document/Link/Link.php @@ -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); @@ -132,7 +132,7 @@ public function toArray() /** * @inheritDoc */ - public function jsonSerialize() + public function jsonSerialize(): mixed { if ($this->hasMeta()) { return $this->toArray(); diff --git a/src/Eloquent/AbstractAdapter.php b/src/Eloquent/AbstractAdapter.php index 5129855d..da5a84a9 100644 --- a/src/Eloquent/AbstractAdapter.php +++ b/src/Eloquent/AbstractAdapter.php @@ -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; diff --git a/tests/lib/Integration/Client/TestCase.php b/tests/lib/Integration/Client/TestCase.php index aea3689d..4a2e5d6d 100644 --- a/tests/lib/Integration/Client/TestCase.php +++ b/tests/lib/Integration/Client/TestCase.php @@ -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; } diff --git a/tests/lib/Integration/ErrorsTest.php b/tests/lib/Integration/ErrorsTest.php index b983ee74..b3d89a38 100644 --- a/tests/lib/Integration/ErrorsTest.php +++ b/tests/lib/Integration/ErrorsTest.php @@ -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', ], ], ]); diff --git a/tests/lib/Unit/Document/LinkTest.php b/tests/lib/Unit/Document/LinkTest.php new file mode 100644 index 00000000..cfb6118e --- /dev/null +++ b/tests/lib/Unit/Document/LinkTest.php @@ -0,0 +1,43 @@ +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) + ); + } +}