From 2f9b88d6d5a089ad495a3ccfe08bffc690b26f32 Mon Sep 17 00:00:00 2001 From: Christian Widlund Date: Thu, 26 Mar 2026 00:02:36 +0100 Subject: [PATCH 1/4] Support Laravel 13.x (#1) * Bump dependencies for Laravel 13 * PHPUnit 12 Shift (#2) * Bump PHPUnit dependencies * Set return type of base TestCase methods From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type: - `setUpBeforeClass()` - `setUp()` - `assertPreConditions()` - `assertPostConditions()` - `tearDown()` - `tearDownAfterClass()` - `onNotSuccessfulTest()` [1]: https://phpunit.de/announcements/phpunit-8.html * Adopt PHP attributes in test classes * Add return types to test methods * Define test classes as `final` --------- Co-authored-by: Shift --------- Co-authored-by: Shift --- composer.json | 11 +++++++---- tests/EtagConditionalsTest.php | 21 +++++++++++---------- tests/IfMatchTest.php | 33 +++++++++++++++++---------------- tests/IfNoneMatchTest.php | 21 +++++++++++---------- tests/SetEtagTest.php | 13 +++++++------ 5 files changed, 53 insertions(+), 46 deletions(-) diff --git a/composer.json b/composer.json index 9fcbf13..0622705 100644 --- a/composer.json +++ b/composer.json @@ -10,13 +10,16 @@ } ], "homepage": "https://github.com/werk365/etagconditionals", - "keywords": ["Laravel", "EtagConditionals"], + "keywords": [ + "Laravel", + "EtagConditionals" + ], "require": { - "illuminate/support": "~7|~8|~9|~10|~11|~12" + "illuminate/support": "~7|~8|~9|~10|~11|~12|^13.0" }, "require-dev": { - "phpunit/phpunit": "~8.0|~9.0", - "orchestra/testbench": "~5|~6|~7|~8" + "phpunit/phpunit": "^12.0", + "orchestra/testbench": "~5|~6|~7|~8|^11.0" }, "autoload": { "psr-4": { diff --git a/tests/EtagConditionalsTest.php b/tests/EtagConditionalsTest.php index 92dc642..ab5a22d 100644 --- a/tests/EtagConditionalsTest.php +++ b/tests/EtagConditionalsTest.php @@ -2,22 +2,23 @@ namespace Werk365\EtagConditionals\Tests; +use PHPUnit\Framework\Attributes\Test; use Illuminate\Http\Request; use Orchestra\Testbench\TestCase; use Symfony\Component\HttpFoundation\Response; use Werk365\EtagConditionals\EtagConditionals; -class EtagConditionalsTest extends TestCase +final class EtagConditionalsTest extends TestCase { private string $response = 'OK'; - public function tearDown(): void + protected function tearDown(): void { EtagConditionals::etagGenerateUsing(null); } - /** @test */ - public function get_default_etag() + #[Test] + public function get_default_etag(): void { $request = Request::create('/', 'GET'); $response = response($this->response, 200); @@ -25,8 +26,8 @@ public function get_default_etag() $this->assertEquals('"e0aa021e21dddbd6d8cecec71e9cf564"', EtagConditionals::getEtag($request, $response)); } - /** @test */ - public function get_etag_with_callback_md5() + #[Test] + public function get_etag_with_callback_md5(): void { $request = Request::create('/', 'GET'); $response = response($this->response, 200); @@ -38,8 +39,8 @@ public function get_etag_with_callback_md5() $this->assertEquals('"e0aa021e21dddbd6d8cecec71e9cf564"', EtagConditionals::getEtag($request, $response)); } - /** @test */ - public function get_etag_with_callback_sophisticated() + #[Test] + public function get_etag_with_callback_sophisticated(): void { $request = Request::create('/', 'GET'); $response = response($this->response, 200); @@ -51,8 +52,8 @@ public function get_etag_with_callback_sophisticated() $this->assertEquals('"sophisticated"', EtagConditionals::getEtag($request, $response)); } - /** @test */ - public function get_etag_with_callback_with_quotes() + #[Test] + public function get_etag_with_callback_with_quotes(): void { $request = Request::create('/', 'GET'); $response = response($this->response, 200); diff --git a/tests/IfMatchTest.php b/tests/IfMatchTest.php index bceafa9..c31bd8b 100644 --- a/tests/IfMatchTest.php +++ b/tests/IfMatchTest.php @@ -2,15 +2,16 @@ namespace Werk365\EtagConditionals\Tests; +use PHPUnit\Framework\Attributes\Test; use Illuminate\Support\Facades\Config; use Orchestra\Testbench\TestCase; use Werk365\EtagConditionals\Middleware\IfMatch; -class IfMatchTest extends TestCase +final class IfMatchTest extends TestCase { private string $response = 'OK'; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -19,8 +20,8 @@ public function setUp(): void }); } - /** @test */ - public function patch_request_returns_200_if_matching_IfMatch() + #[Test] + public function patch_request_returns_200_if_matching_IfMatch(): void { $ifMatch = '"'.md5($this->response).'"'; $response = $this->withHeaders([ @@ -31,8 +32,8 @@ public function patch_request_returns_200_if_matching_IfMatch() $response->assertStatus(200); } - /** @test */ - public function patch_request_returns_200_if_matching_IfMatch_in_list_of_etags() + #[Test] + public function patch_request_returns_200_if_matching_IfMatch_in_list_of_etags(): void { $ifMatch = '"'.md5('first').'", "'.md5($this->response).'","'.md5('last').'"'; $response = $this->withHeaders([ @@ -43,8 +44,8 @@ public function patch_request_returns_200_if_matching_IfMatch_in_list_of_etags() $response->assertStatus(200); } - /** @test */ - public function patch_request_returns_200_if_wildcard_is_used() + #[Test] + public function patch_request_returns_200_if_wildcard_is_used(): void { $ifMatch = '"'.md5('first').'", "*","'.md5('last').'"'; $response = $this->withHeaders([ @@ -55,8 +56,8 @@ public function patch_request_returns_200_if_wildcard_is_used() $response->assertStatus(200); } - /** @test */ - public function patch_request_returns_412_if_none_matching_IfMatch() + #[Test] + public function patch_request_returns_412_if_none_matching_IfMatch(): void { $ifMatch = '"'.md5($this->response.'ifMatch').'"'; $response = $this->withHeaders([ @@ -67,8 +68,8 @@ public function patch_request_returns_412_if_none_matching_IfMatch() $response->assertStatus(412); } - /** @test */ - public function patch_request_returns_412_if_none_matching_IfMatch_in_list_of_etags() + #[Test] + public function patch_request_returns_412_if_none_matching_IfMatch_in_list_of_etags(): void { $ifMatch = '"'.md5('first').'", "'.md5($this->response.'ifMatch').'","'.md5('last').'"'; $response = $this->withHeaders([ @@ -79,8 +80,8 @@ public function patch_request_returns_412_if_none_matching_IfMatch_in_list_of_et $response->assertStatus(412); } - /** @test */ - public function patch_request_returns_200_if_matching_weaktag_when_weak_is_enabled_in_config() + #[Test] + public function patch_request_returns_200_if_matching_weaktag_when_weak_is_enabled_in_config(): void { Config::set('etagconditionals.if_match_weak', true); $ifMatch = 'W/"'.md5($this->response).'"'; @@ -92,8 +93,8 @@ public function patch_request_returns_200_if_matching_weaktag_when_weak_is_enabl $response->assertStatus(200); } - /** @test */ - public function patch_request_returns_412_if_matching_weaktag_when_weak_is_disabled_in_config() + #[Test] + public function patch_request_returns_412_if_matching_weaktag_when_weak_is_disabled_in_config(): void { Config::set('etagconditionals.if_match_weak', false); $ifMatch = 'W/"'.md5($this->response).'"'; diff --git a/tests/IfNoneMatchTest.php b/tests/IfNoneMatchTest.php index ec3091e..2c9a798 100644 --- a/tests/IfNoneMatchTest.php +++ b/tests/IfNoneMatchTest.php @@ -2,15 +2,16 @@ namespace Werk365\EtagConditionals\Tests; +use PHPUnit\Framework\Attributes\Test; use Illuminate\Support\Facades\Config; use Orchestra\Testbench\TestCase; use Werk365\EtagConditionals\Middleware\IfNoneMatch; -class IfNoneMatchTest extends TestCase +final class IfNoneMatchTest extends TestCase { private string $response = 'OK'; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -19,8 +20,8 @@ public function setUp(): void }); } - /** @test */ - public function get_request_status_200_with_none_matching_IfNoneMatch() + #[Test] + public function get_request_status_200_with_none_matching_IfNoneMatch(): void { $noneMatch = '"'.md5($this->response.'NoneMatch').'"'; $response = $this->withHeaders([ @@ -31,8 +32,8 @@ public function get_request_status_200_with_none_matching_IfNoneMatch() $response->assertStatus(200); } - /** @test */ - public function get_request_status_304_with_matching_IfNoneMatch() + #[Test] + public function get_request_status_304_with_matching_IfNoneMatch(): void { $noneMatch = '"'.md5($this->response).'"'; $response = $this->withHeaders([ @@ -43,8 +44,8 @@ public function get_request_status_304_with_matching_IfNoneMatch() $response->assertStatus(304); } - /** @test */ - public function get_request_status_200_with_matching_weaktag_if_weak_is_disabled_in_config() + #[Test] + public function get_request_status_200_with_matching_weaktag_if_weak_is_disabled_in_config(): void { Config::set('etagconditionals.if_none_match_weak', false); $noneMatch = 'W/"'.md5($this->response).'"'; @@ -56,8 +57,8 @@ public function get_request_status_200_with_matching_weaktag_if_weak_is_disabled $response->assertStatus(200); } - /** @test */ - public function get_request_status_304_with_matching_weaktag_if_weak_is_enabled_in_config() + #[Test] + public function get_request_status_304_with_matching_weaktag_if_weak_is_enabled_in_config(): void { Config::set('etagconditionals.if_none_match_weak', true); $noneMatch = 'W/"'.md5($this->response).'"'; diff --git a/tests/SetEtagTest.php b/tests/SetEtagTest.php index 2dacba7..7fe4a4b 100644 --- a/tests/SetEtagTest.php +++ b/tests/SetEtagTest.php @@ -2,14 +2,15 @@ namespace Werk365\EtagConditionals\Tests; +use PHPUnit\Framework\Attributes\Test; use Orchestra\Testbench\TestCase; use Werk365\EtagConditionals\Middleware\SetEtag; -class SetEtagTest extends TestCase +final class SetEtagTest extends TestCase { private string $response = 'OK'; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -18,15 +19,15 @@ public function setUp(): void }); } - /** @test */ - public function middleware_sets_etag_header() + #[Test] + public function middleware_sets_etag_header(): void { $response = $this->get('/_test/set-etag'); $response->assertHeader('ETag', $value = null); } - /** @test */ - public function etag_header_has_correct_value() + #[Test] + public function etag_header_has_correct_value(): void { $value = '"'.md5($this->response).'"'; $response = $this->get('/_test/set-etag'); From 797e0332b41333fcaeb88d8ad7d34245218891d3 Mon Sep 17 00:00:00 2001 From: Christian Widlund Date: Thu, 26 Mar 2026 00:22:26 +0100 Subject: [PATCH 2/4] Upgrade PHP version from 8.1 to 8.3 in Scrutinizer --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 4b34db1..fcdc076 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ build: environment: php: - version: 8.1 + version: 8.3 nodes: analysis: project_setup: From 24d9c0b536e9cb2d558dd7b886a4823c42eb1baf Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Mar 2026 11:55:39 +0100 Subject: [PATCH 3/4] Fix alphabetical ordering of use statements in test files (#3) * Initial plan * Fix alphabetical ordering of use statements in test files Co-authored-by: chrillep <1267931+chrillep@users.noreply.github.com> Agent-Logs-Url: https://github.com/chrillep/etagconditionals/sessions/2a850694-3bc5-4413-ae12-ff9aac9bd13e --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: chrillep <1267931+chrillep@users.noreply.github.com> --- tests/EtagConditionalsTest.php | 2 +- tests/IfMatchTest.php | 2 +- tests/IfNoneMatchTest.php | 2 +- tests/SetEtagTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/EtagConditionalsTest.php b/tests/EtagConditionalsTest.php index ab5a22d..8e38369 100644 --- a/tests/EtagConditionalsTest.php +++ b/tests/EtagConditionalsTest.php @@ -2,9 +2,9 @@ namespace Werk365\EtagConditionals\Tests; -use PHPUnit\Framework\Attributes\Test; use Illuminate\Http\Request; use Orchestra\Testbench\TestCase; +use PHPUnit\Framework\Attributes\Test; use Symfony\Component\HttpFoundation\Response; use Werk365\EtagConditionals\EtagConditionals; diff --git a/tests/IfMatchTest.php b/tests/IfMatchTest.php index c31bd8b..57625c3 100644 --- a/tests/IfMatchTest.php +++ b/tests/IfMatchTest.php @@ -2,9 +2,9 @@ namespace Werk365\EtagConditionals\Tests; -use PHPUnit\Framework\Attributes\Test; use Illuminate\Support\Facades\Config; use Orchestra\Testbench\TestCase; +use PHPUnit\Framework\Attributes\Test; use Werk365\EtagConditionals\Middleware\IfMatch; final class IfMatchTest extends TestCase diff --git a/tests/IfNoneMatchTest.php b/tests/IfNoneMatchTest.php index 2c9a798..f15ea18 100644 --- a/tests/IfNoneMatchTest.php +++ b/tests/IfNoneMatchTest.php @@ -2,9 +2,9 @@ namespace Werk365\EtagConditionals\Tests; -use PHPUnit\Framework\Attributes\Test; use Illuminate\Support\Facades\Config; use Orchestra\Testbench\TestCase; +use PHPUnit\Framework\Attributes\Test; use Werk365\EtagConditionals\Middleware\IfNoneMatch; final class IfNoneMatchTest extends TestCase diff --git a/tests/SetEtagTest.php b/tests/SetEtagTest.php index 7fe4a4b..0736deb 100644 --- a/tests/SetEtagTest.php +++ b/tests/SetEtagTest.php @@ -2,8 +2,8 @@ namespace Werk365\EtagConditionals\Tests; -use PHPUnit\Framework\Attributes\Test; use Orchestra\Testbench\TestCase; +use PHPUnit\Framework\Attributes\Test; use Werk365\EtagConditionals\Middleware\SetEtag; final class SetEtagTest extends TestCase From 85e109be0e63183e88af982e15185602d46aa229 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Mar 2026 12:32:00 +0100 Subject: [PATCH 4/4] Fix Scrutinizer CI: pin PHP to 8.3.28 (#4) * Initial plan * Fix PHP runtime build error: downgrade PHP version from 8.3 to 8.2 in .scrutinizer.yml Co-authored-by: chrillep <1267931+chrillep@users.noreply.github.com> Agent-Logs-Url: https://github.com/chrillep/etagconditionals/sessions/43f5e0f4-10a3-44ce-85be-9daaf2331fff * Fix Scrutinizer CI: pin PHP to 8.3.3 to avoid broken 8.3.4 mirror Co-authored-by: chrillep <1267931+chrillep@users.noreply.github.com> Agent-Logs-Url: https://github.com/chrillep/etagconditionals/sessions/9c5eff0d-2a61-4f8c-9f84-20f4a2a6292d * Fix Scrutinizer CI: update PHP version to 8.3.28 (confirmed working on mirror) Co-authored-by: chrillep <1267931+chrillep@users.noreply.github.com> Agent-Logs-Url: https://github.com/chrillep/etagconditionals/sessions/37d5f5ba-b4e9-49d9-9ff7-76ccff4dfdd6 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: chrillep <1267931+chrillep@users.noreply.github.com> --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index fcdc076..7a0aa8e 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ build: environment: php: - version: 8.3 + version: 8.3.28 nodes: analysis: project_setup: