Skip to content

Commit 49d68fe

Browse files
Merge pull request #36 from chrisguitarguy/fix_ci
Drop PHP 8.2 Support, Drop Symfony 5.4 and <6.4 Support
2 parents b2e39c0 + 6bd661c commit 49d68fe

File tree

11 files changed

+90
-49
lines changed

11 files changed

+90
-49
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@ jobs:
2222
strategy:
2323
matrix:
2424
php-version:
25-
- '8.2'
2625
- '8.3'
2726
- '8.4'
2827
symfony-require:
29-
- '5.4.*'
3028
- '6.*'
3129
- '7.*'
3230
composer-flags:
3331
- ''
3432
- '--prefer-lowest'
3533
steps:
3634
- name: "Checkout"
37-
uses: "actions/checkout@v2"
35+
uses: "actions/checkout@v4"
3836
with:
3937
fetch-depth: 2
4038

@@ -50,7 +48,7 @@ jobs:
5048
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
5149

5250
- name: Cache dependencies
53-
uses: actions/cache@v2
51+
uses: actions/cache@v4
5452
with:
5553
path: ${{ steps.composercache.outputs.dir }}
5654
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# CHANGELOG
22

3-
## 6.1.0
4-
- Added support for PHP 8.4
3+
## 7.0.0
4+
5+
- Support PHP 8.4
6+
- Dropped PHP 8.2 Support
7+
- Dropped Symfony 5.X and <6.4 support
8+
59
## 6.0.0
610

711
- Dropped support for Symfony 4.4.X (thanks @arnedesmedt)

composer.json

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,54 @@
55
"license": "MIT",
66
"type": "symfony-bundle",
77
"require": {
8-
"php": "^8.2",
9-
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
10-
"ramsey/uuid": "^3.9 || ^4.3"
8+
"php": "^8.3",
9+
"symfony/framework-bundle": "^6.4.22 || ^7.0.10",
10+
"ramsey/uuid": "^4.8"
1111
},
1212
"require-dev": {
13-
"phpunit/phpunit": "^9.5",
14-
"symfony/monolog-bundle": "^3.7",
15-
"twig/twig": "^2.7 || ^3.0",
16-
"symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0",
17-
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0",
18-
"symfony/css-selector": "^5.4 || ^6.0 || ^7.0",
19-
"symfony/phpunit-bridge": "^5.4 || ^6.0 || ^7.0",
20-
"symfony/yaml": "^5.4 || ^6.0 || ^7.0",
21-
"symfony/templating": "^5.4 || ^6.0 || ^7.0",
22-
"symfony/monolog-bridge": "^5.4 || ^6.0 || ^7.0"
13+
"phpunit/phpunit": "^12.2",
14+
"symfony/monolog-bundle": "^3.10",
15+
"twig/twig": "^3.9",
16+
"symfony/twig-bundle": "^6.4.13 || ^7.0.8",
17+
"symfony/twig-bridge": "^6.4.22 || ^7.0.8",
18+
"symfony/browser-kit": "^6.4.19 || ^7.0.8",
19+
"symfony/dom-crawler": "^6.4.19 || ^7.0.8",
20+
"symfony/css-selector": "^6.4.13 || ^7.0.8",
21+
"symfony/phpunit-bridge": "^6.4.16 || ^7.0.10",
22+
"symfony/yaml": "^6.4.21 || ^7.0.8",
23+
"symfony/monolog-bridge": "^6.4.13 || ^7.0.8",
24+
"symfony/templating": "^6.4.13",
25+
"symfony/event-dispatcher": "^6.4.13 || ^7.0.8",
26+
"symfony/event-dispatcher-contracts": "^3.5",
27+
"symfony/http-foundation": "^6.4.22 || ^7.0.10",
28+
"symfony/http-kernel": "^6.4.22 || ^7.0.10",
29+
"symfony/routing": "^6.4.22 || ^7.0.10",
30+
"symfony/config": "^6.4.22 || ^7.0.8",
31+
"symfony/var-exporter": "^6.4.22 || ^7.0.9",
32+
"symfony/error-handler": "^6.4.22 || ^7.0.10",
33+
"symfony/translation": "^6.4.22 || ^7.0.10",
34+
"symfony/translation-contracts": "^3.5",
35+
"symfony/filesystem": "^6.4.13 || ^7.0.9",
36+
"symfony/cache": "^6.4.21 || ^7.0.10",
37+
"symfony/cache-contracts": "^3.5",
38+
"symfony/dependency-injection": "^6.4.22 || ^7.0.10"
2339
},
2440
"autoload": {
2541
"psr-4": {
2642
"Chrisguitarguy\\RequestId\\": "src/"
2743
}
2844
},
45+
"autoload-dev": {
46+
"psr-4": {
47+
"Chrisguitarguy\\RequestId\\": [
48+
"test/unit/",
49+
"test/acceptance/"
50+
]
51+
},
52+
"files": [
53+
"test/acceptance/app/TestKernel.php"
54+
]
55+
},
2956
"conflict": {
3057
"twig/twig": "<2.7"
3158
},

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.2/phpunit.xsd"
55
backupGlobals="false"
66
backupStaticAttributes="false"
77
colors="true"

test/acceptance/AcceptanceTest.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212

1313
namespace Chrisguitarguy\RequestId;
1414

15+
use PHPUnit\Framework\Attributes\DataProvider;
1516
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1617
use Symfony\Component\HttpFoundation\Response;
1718

18-
class HttpTest extends WebTestCase
19+
class AcceptanceTest extends WebTestCase
1920
{
20-
public function testRequestThatAlreadyHasARequestIdDoesNotReplaceIt()
21+
public function testRequestThatAlreadyHasARequestIdDoesNotReplaceIt() : void
2122
{
2223
$client = $this->createClient();
2324

@@ -37,7 +38,7 @@ public function testRequestThatAlreadyHasARequestIdDoesNotReplaceIt()
3738
);
3839
}
3940

40-
public function testAlreadySetRequestIdUsesValueFromStorage()
41+
public function testAlreadySetRequestIdUsesValueFromStorage() : void
4142
{
4243
$client = $this->createClient();
4344
$client->getContainer()->get(RequestIdStorage::class)->setRequestId('abc123');
@@ -57,7 +58,7 @@ public function testAlreadySetRequestIdUsesValueFromStorage()
5758
);
5859
}
5960

60-
public function testRequestWithOutRequestIdCreatesOnAndPassesThroughTheResponse()
61+
public function testRequestWithOutRequestIdCreatesOnAndPassesThroughTheResponse() : void
6162
{
6263
$client = $this->createClient();
6364

@@ -78,18 +79,19 @@ public function testRequestWithOutRequestIdCreatesOnAndPassesThroughTheResponse(
7879
);
7980
}
8081

81-
public static function publicServices()
82+
/**
83+
* @return array<string[]>
84+
*/
85+
public static function publicServices() : array
8286
{
8387
return [
8488
[RequestIdStorage::class],
8589
[RequestIdGenerator::class],
8690
];
8791
}
8892

89-
/**
90-
* @dataProvider publicServices
91-
*/
92-
public function testExpectedServicesArePubliclyAvaiableFromTheContainer(string $class)
93+
#[DataProvider('publicServices')]
94+
public function testExpectedServicesArePubliclyAvaiableFromTheContainer(string $class) : void
9395
{
9496
$client = $this->createClient();
9597

@@ -111,14 +113,14 @@ private function getLogs($client) : array
111113
return $client->getContainer()->get('log.memory_handler')->getLogs();
112114
}
113115

114-
private function assertLogsHaveRequestId($client, $id)
116+
private function assertLogsHaveRequestId($client, $id) : void
115117
{
116118
foreach ($this->getLogs($client) as $msg) {
117-
$this->assertStringContainsString($id, $msg); // veri
119+
$this->assertStringContainsString($id, $msg);
118120
}
119121
}
120122

121-
private function assertSuccessfulResponse($resp)
123+
private function assertSuccessfulResponse($resp) : void
122124
{
123125
$this->assertInstanceOf(Response::class, $resp);
124126
$this->assertGreaterThanOrEqual(200, $resp->getStatusCode());

test/bootstrap.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* @license http://opensource.org/licenses/MIT MIT
1111
*/
1212

13-
$loader = require __DIR__.'/../vendor/autoload.php';
14-
$loader->addPsr4('Chrisguitarguy\\RequestId\\', __DIR__.'/acceptance/');
15-
$loader->addPsr4('Chrisguitarguy\\RequestId\\', __DIR__.'/unit/');
16-
require __DIR__.'/acceptance/app/TestKernel.php';
13+
// https://github.com/symfony/symfony/issues/53812#issuecomment-1962740145
14+
use Symfony\Component\ErrorHandler\ErrorHandler;
15+
set_exception_handler([new ErrorHandler(), 'handleException']);

test/unit/EventListener/RequestIdListenerTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Chrisguitarguy\RequestId\EventListener;
1414

15+
use PHPUnit\Framework\MockObject\MockObject;
1516
use Chrisguitarguy\RequestId\RequestIdGenerator;
1617
use Chrisguitarguy\RequestId\RequestIdStorage;
1718
use Chrisguitarguy\RequestId\UnitTestCase;
@@ -28,7 +29,13 @@ class RequestIdListenerTest extends UnitTestCase
2829
const REQUEST_HEADER = 'Request-Id';
2930
const RESPONSE_HEADER = 'Response-Id';
3031

31-
private $idStorage, $idGen, $listener, $dispatcher, $request, $response, $kernel;
32+
private RequestIdStorage&MockObject $idStorage;
33+
private RequestIdGenerator&MockObject $idGen;
34+
private RequestIdListener $listener;
35+
private EventDispatcher $dispatcher;
36+
private Request $request;
37+
private Response $response;
38+
private HttpKernelInterface&MockObject $kernel;
3239

3340
public function testNonMasterRequestsDoNothingOnRequest()
3441
{

test/unit/Generator/RamseyUuid4GeneratorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717

1818
class RamseyUuid4GeneratorTest extends UnitTestCase
1919
{
20-
public function testGenerateReturnsANewStringIdentifier()
20+
public function testGenerateReturnsANewStringIdentifier() : void
2121
{
2222
if (!interface_exists(UuidFactoryInterface::class)) {
23-
return $this->markTestSkipped(sprintf('%s requires the %s class', __METHOD__, UuidFactoryInterface::class));
23+
$this->markTestSkipped(sprintf('%s requires the %s class', __METHOD__, UuidFactoryInterface::class));
24+
return;
2425
}
2526

2627
// we're not going to mock anything here, I'm more

test/unit/Monolog/RequestIdProcessorTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Chrisguitarguy\RequestId\Monolog;
1414

15+
use PHPUnit\Framework\MockObject\MockObject;
1516
use Chrisguitarguy\RequestId\RequestIdStorage;
1617
use Chrisguitarguy\RequestId\UnitTestCase;
1718
use Monolog\Level;
@@ -20,9 +21,10 @@
2021

2122
class RequestIdProcessorTest extends UnitTestCase
2223
{
23-
private $idStorage, $processor;
24+
private RequestIdStorage&MockObject $idStorage;
25+
private RequestIdProcessor $processor;
2426

25-
public function testProcessorDoesNotSetRequestIdWhenNoIdIsPresent()
27+
public function testProcessorDoesNotSetRequestIdWhenNoIdIsPresent() : void
2628
{
2729
if (version_compare(Logger::API, '3', 'ge')) {
2830
self::markTestSkipped('The version 1 or 2 of Monolog is required to run this test.');
@@ -35,7 +37,7 @@ public function testProcessorDoesNotSetRequestIdWhenNoIdIsPresent()
3537
$this->assertArrayNotHasKey('request_id', $record['extra']);
3638
}
3739

38-
public function testProcessorAddsRequestIdWhenIdIsPresent()
40+
public function testProcessorAddsRequestIdWhenIdIsPresent() : void
3941
{
4042
if (version_compare(Logger::API, '3', 'ge')) {
4143
self::markTestSkipped('The version 1 or 2 of Monolog is required to run this test.');
@@ -49,7 +51,7 @@ public function testProcessorAddsRequestIdWhenIdIsPresent()
4951
$this->assertEquals('abc123', $record['extra']['request_id']);
5052
}
5153

52-
public function testProcessorDoesNotSetRequestIdWhenNoIdIsPresentWithMonologAtLeast3()
54+
public function testProcessorDoesNotSetRequestIdWhenNoIdIsPresentWithMonologAtLeast3() : void
5355
{
5456
if (version_compare(Logger::API, '3', 'lt')) {
5557
self::markTestSkipped('The Monolog at least 3 is required to run this test.');
@@ -64,7 +66,7 @@ public function testProcessorDoesNotSetRequestIdWhenNoIdIsPresentWithMonologAtLe
6466
$this->assertArrayNotHasKey('request_id', $record->extra);
6567
}
6668

67-
public function testProcessorAddsRequestIdWhenIdIsPresentWithMonologAtLeast3()
69+
public function testProcessorAddsRequestIdWhenIdIsPresentWithMonologAtLeast3() : void
6870
{
6971
if (version_compare(Logger::API, '3', 'lt')) {
7072
self::markTestSkipped('The Monolog at least 3 is required to run this test.');
@@ -86,7 +88,7 @@ protected function setUp(): void
8688
$this->processor = new RequestIdProcessor($this->idStorage);
8789
}
8890

89-
private function withRequestId($id)
91+
private function withRequestId($id) : void
9092
{
9193
$this->idStorage->expects($this->once())
9294
->method('getRequestId')

test/unit/SimpleIdStorageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class SimpleIdStorageTest extends UnitTestCase
1616
{
17-
public function testGetRequestIdReturnsTheSameValueThatWasSet()
17+
public function testGetRequestIdReturnsTheSameValueThatWasSet() : void
1818
{
1919
$s = new SimpleIdStorage();
2020

@@ -23,7 +23,7 @@ public function testGetRequestIdReturnsTheSameValueThatWasSet()
2323
$this->assertEquals('test', $s->getRequestId());
2424
}
2525

26-
public function testNullCanBePassedToSetRequestIdToClearIt()
26+
public function testNullCanBePassedToSetRequestIdToClearIt() : void
2727
{
2828
$s = new SimpleIdStorage();
2929
$s->setRequestId('test');

0 commit comments

Comments
 (0)