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
18 changes: 8 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 8.2, 8.3, 8.4 ]
core: [ '4.3.2', '5.2' ]
laravel: [ 11, 12 ]
php: [ 8.2, 8.3, 8.4, 8.5 ]
laravel: [ 11, 12, 13 ]
exclude:
- laravel: 12
core: '4.3.2'
- php: 8.5
laravel: 11
- php: 8.2
laravel: 13

steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -38,14 +39,11 @@ jobs:
coverage: none
ini-values: error_reporting=E_ALL

- name: Set Laravel JSON:API Core Version
run: composer require "laravel-json-api/core:^${{ matrix.core }}" --no-update

- name: Set Laravel Version
run: composer require "illuminate/contracts:^${{ matrix.laravel }}" --no-update

- name: Install dependencies
uses: nick-fields/retry@v3
uses: nick-fields/retry@v4
with:
timeout_minutes: 5
max_attempts: 5
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-json-api/core` v4.

## [3.2.0] - 2025-02-24

### Added
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"require": {
"php": "^8.2",
"ext-json": "*",
"illuminate/contracts": "^11.0|^12.0",
"illuminate/pipeline": "^11.0|^12.0",
"laravel-json-api/core": "^4.3.2|^5.2",
"laravel-json-api/validation": "^4.2"
"illuminate/contracts": "^11.0|^12.0|^13.0",
"illuminate/pipeline": "^11.0|^12.0|^13.0",
"laravel-json-api/core": "^5.3",
"laravel-json-api/validation": "^4.4"
},
"require-dev": {
"laravel-json-api/testing": "^3.1",
"orchestra/testbench": "^9.0|^10.0",
"orchestra/testbench": "^9.0|^10.0|^11.0",
"phpunit/phpunit": "^10.5|^11.5.3"
},
"autoload": {
Expand All @@ -50,7 +50,7 @@
"dev-develop": "3.x-dev"
}
},
"minimum-stability": "stable",
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
Expand Down
28 changes: 16 additions & 12 deletions tests/Integration/AcceptHeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,13 @@ public function testAcceptsMiddlewareDoesNotMatch(): void
->acceptsMiddleware('foo', 'bar')
->renderable();

$this->get('/test', ['Accept' => '*/*'])
$response = $this->get('/test', ['Accept' => '*/*']);

$response
->assertStatus(418)
->assertHeader('Content-Type', 'text/html; charset=UTF-8')
->assertSee('teapot');

$this->assertSame('text/html; charset=utf-8', strtolower($response->headers->get('Content-Type')));
}

/**
Expand All @@ -167,11 +170,7 @@ public function testAcceptsMiddlewareWhenRouteNotFound(): void

$response = $this->get('/blah', ['Accept' => '*/*']);
$response->assertStatus(404)->assertSee('Not Found');

// @TODO remove once Laravel 8 is no longer supported (8 doesn't add the header)
if (version_compare(Application::VERSION, '9.0.0') >= 0) {
$response->assertHeader('Content-Type', 'text/html; charset=UTF-8');
}
$this->assertSame('text/html; charset=utf-8', strtolower($response->headers->get('Content-Type')));
}

public function testAcceptsMiddlewareWhenRouteNotFoundWithJsonApiMediaType(): void
Expand Down Expand Up @@ -223,10 +222,12 @@ public function testAcceptFalse(): void
->accept(fn(\Throwable $ex, Request $request) => false)
->renderable();

$this->get('/test', ['Accept' => '*/*'])
->assertStatus(418)
->assertHeader('Content-Type', 'text/html; charset=UTF-8')
$response = $this->get('/test', ['Accept' => '*/*']);

$response->assertStatus(418)
->assertSee('teapot');

$this->assertSame('text/html; charset=utf-8', strtolower($response->headers->get('Content-Type')));
}

public function testAcceptFalseWithJsonApiAcceptHeader(): void
Expand Down Expand Up @@ -279,9 +280,12 @@ public function testMultipleAcceptCallbacks2(): void

public function testHtml(): void
{
$this->get('/test', ['Accept' => '*/*'])
$response = $this->get('/test', ['Accept' => '*/*']);

$response
->assertStatus(418)
->assertHeader('Content-Type', 'text/html; charset=UTF-8')
->assertSee('teapot');

$this->assertSame('text/html; charset=utf-8', strtolower($response->headers->get('Content-Type')));
}
}