From fb8c13cfd3a33e77a85422ab9d1d618dd0f344b6 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 16 May 2026 20:44:59 +1000 Subject: [PATCH] feat: add PHP 8.5 support - Bump PHP version constraint from <8.5 to <8.6 - Add ?string $uriParserClass parameter to SoapClient::__doRequest() for PHP 8.5 compatibility - Replace deprecated PHPUnit setMethods() with onlyMethods() across all test files - Add PHP 8.5 to CI test matrix Co-Authored-By: Claude Opus 4.6 --- .github/workflows/continuous integration.yml | 1 + composer.json | 2 +- src/VCR/Util/SoapClient.php | 2 +- tests/Unit/CodeTransform/AbstractCodeTransformTest.php | 2 +- tests/Unit/Util/SoapClientTest.php | 4 ++-- tests/Unit/VideorecorderTest.php | 6 +++--- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/continuous integration.yml b/.github/workflows/continuous integration.yml index 0f88bd335..a328bee33 100644 --- a/.github/workflows/continuous integration.yml +++ b/.github/workflows/continuous integration.yml @@ -92,6 +92,7 @@ jobs: - "8.2" - "8.3" - "8.4" + - "8.5" dependencies: - "lowest" - "highest" diff --git a/composer.json b/composer.json index c27427ad5..93463b06d 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } ], "require": { - "php": "^8,<8.2|>=8.2.9,<8.5", + "php": "^8,<8.2|>=8.2.9,<8.6", "ext-curl": "*", "beberlei/assert": "^3.2.5", "symfony/yaml": "^3|^4|^5|^6|^7", diff --git a/src/VCR/Util/SoapClient.php b/src/VCR/Util/SoapClient.php index e892eb33e..883ca4ffb 100644 --- a/src/VCR/Util/SoapClient.php +++ b/src/VCR/Util/SoapClient.php @@ -37,7 +37,7 @@ public function __construct(?string $wsdl, array $options = []) * * Requests will be intercepted if the library hook is enabled. */ - public function __doRequest(string $request, string $location, string $action, int $version, bool $one_way = false): ?string + public function __doRequest(string $request, string $location, string $action, int $version, bool $one_way = false, ?string $uriParserClass = null): ?string { $this->request = $request; diff --git a/tests/Unit/CodeTransform/AbstractCodeTransformTest.php b/tests/Unit/CodeTransform/AbstractCodeTransformTest.php index 847ba0658..352be7c6d 100644 --- a/tests/Unit/CodeTransform/AbstractCodeTransformTest.php +++ b/tests/Unit/CodeTransform/AbstractCodeTransformTest.php @@ -23,7 +23,7 @@ protected function getFilter(array $methods = []) ); $filter = $this->getMockBuilder(AbstractCodeTransform::class) - ->setMethods($defaults) + ->onlyMethods($defaults) ->getMockForAbstractClass(); if (\in_array('transformCode', $methods)) { diff --git a/tests/Unit/Util/SoapClientTest.php b/tests/Unit/Util/SoapClientTest.php index 5f03b5623..bd470ea1b 100644 --- a/tests/Unit/Util/SoapClientTest.php +++ b/tests/Unit/Util/SoapClientTest.php @@ -19,7 +19,7 @@ protected function getLibraryHookMock(bool $enabled) { $hookMock = $this->getMockBuilder(SoapHook::class) ->disableOriginalConstructor() - ->setMethods(['isEnabled', 'doRequest']) + ->onlyMethods(['isEnabled', 'doRequest']) ->getMock(); $hookMock @@ -85,7 +85,7 @@ public function testDoRequestHandlesHookDisabled(): void { $client = $this->getMockBuilder(SoapClient::class) ->disableOriginalConstructor() - ->setMethods(['realDoRequest']) + ->onlyMethods(['realDoRequest']) ->getMock(); $client diff --git a/tests/Unit/VideorecorderTest.php b/tests/Unit/VideorecorderTest.php index 337283ddf..bf142f245 100644 --- a/tests/Unit/VideorecorderTest.php +++ b/tests/Unit/VideorecorderTest.php @@ -34,7 +34,7 @@ public function testInsertCassetteEjectExisting(): void $configuration->enableLibraryHooks([]); $videorecorder = $this->getMockBuilder('\VCR\Videorecorder') ->setConstructorArgs([$configuration, new HttpClient(), VCRFactory::getInstance()]) - ->setMethods(['eject', 'resetIndex']) + ->onlyMethods(['eject', 'resetIndex']) ->getMock(); $videorecorder->expects($this->exactly(2))->method('eject'); @@ -144,7 +144,7 @@ public function setCassette(Cassette $cassette): void protected function getClientMock(Request $request, Response $response): HttpClient { - $client = $this->getMockBuilder(HttpClient::class)->setMethods(['send'])->getMock(); + $client = $this->getMockBuilder(HttpClient::class)->onlyMethods(['send'])->getMock(); $client ->expects($this->once()) ->method('send') @@ -158,7 +158,7 @@ protected function getCassetteMock(Request $request, Response $response, string { $cassette = $this->getMockBuilder(Cassette::class) ->disableOriginalConstructor() - ->setMethods(['record', 'playback', 'isNew', 'getName']) + ->onlyMethods(['record', 'playback', 'isNew', 'getName']) ->getMock(); $cassette ->expects($this->once())