From 9ab18b129cf107d6ea28319aad064f7fc387d28f Mon Sep 17 00:00:00 2001 From: Vizzent Date: Fri, 6 Nov 2026 10:03:36 +0100 Subject: [PATCH 1/4] Allow PHPUnit 13 Add ^13.0 to the phpunit/phpunit constraint. PHPUnit 13 is the latest stable major; Codeception supports it from 5.3.5. PHPUnit 13 requires PHP >= 8.4.1, so drop --ignore-platform-reqs from the PHP 8.3 and 8.4 CI jobs. Otherwise PHP 8.3 would install a PHPUnit version it cannot run. Without the flag, Composer resolves 12.5 there. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 4 ++-- composer.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2332953..6f8aba6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,11 +47,11 @@ jobs: experimental: true dependencies: "highest" - php: "8.3" - composer-options: "--ignore-platform-reqs" + composer-options: "" experimental: true dependencies: "highest" - php: "8.4" - composer-options: "--ignore-platform-reqs" + composer-options: "" experimental: true dependencies: "highest" steps: diff --git a/composer.json b/composer.json index 3cf5eb4..c0ea6ed 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "php": "7.4.*||8.*", "guzzlehttp/guzzle": "^7.0", "codeception/codeception": "4.*||5.*", - "phpunit/phpunit": "^8.5 || ^9.0 || ^10.0 || ^11.0 || ^12.0", + "phpunit/phpunit": "^8.5 || ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0", "jfcherng/php-diff": "^6.14" }, "require-dev": { From 9a59b01f67ad13908a565a32beb0c9694ff8aadb Mon Sep 17 00:00:00 2001 From: Vizzent Date: Fri, 6 Nov 2026 10:07:10 +0100 Subject: [PATCH 2/4] Make tests platform independent and use stubs Compare the failure message against "\n" instead of PHP_EOL, because PHPUnit always joins the message with "\n". This fixes 2 failures on Windows. Use createStub() for ModuleContainer, which has no expectations. This removes the PHPUnit notices reported since PHPUnit 12. Co-Authored-By: Claude Opus 5.5 --- tests/Integration/NotMatchedRequestTest.php | 2 +- tests/Integration/SeeAllRequestWereMatchedTest.php | 2 +- tests/Integration/SeeMockRequestWasCalledTest.php | 5 +++-- tests/Integration/SeeMockRequestWasNotCalledTest.php | 5 +++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/Integration/NotMatchedRequestTest.php b/tests/Integration/NotMatchedRequestTest.php index 6bc1ef4..ddc27a0 100644 --- a/tests/Integration/NotMatchedRequestTest.php +++ b/tests/Integration/NotMatchedRequestTest.php @@ -17,7 +17,7 @@ class NotMatchedRequestTest extends TestCase private function initialize(string $notMatchedRequestConfig): void { - $moduleContainer = $this->createMock(ModuleContainer::class); + $moduleContainer = $this->createStub(ModuleContainer::class); $this->sot = new MockServerHelper( $moduleContainer, [ diff --git a/tests/Integration/SeeAllRequestWereMatchedTest.php b/tests/Integration/SeeAllRequestWereMatchedTest.php index a968554..dccaf2b 100644 --- a/tests/Integration/SeeAllRequestWereMatchedTest.php +++ b/tests/Integration/SeeAllRequestWereMatchedTest.php @@ -16,7 +16,7 @@ class SeeAllRequestWereMatchedTest extends TestCase protected function initialize(string $notMatchedRequest): void { - $moduleContainer = $this->createMock(ModuleContainer::class); + $moduleContainer = $this->createStub(ModuleContainer::class); $config = [ 'url' => getenv('MOCKSERVER_URL'), 'notMatchedRequest' => $notMatchedRequest, diff --git a/tests/Integration/SeeMockRequestWasCalledTest.php b/tests/Integration/SeeMockRequestWasCalledTest.php index 5ee0841..33b1659 100644 --- a/tests/Integration/SeeMockRequestWasCalledTest.php +++ b/tests/Integration/SeeMockRequestWasCalledTest.php @@ -17,7 +17,7 @@ class SeeMockRequestWasCalledTest extends TestCase protected function setUp(): void { parent::setUp(); - $moduleContainer = $this->createMock(ModuleContainer::class); + $moduleContainer = $this->createStub(ModuleContainer::class); $config = [ 'url' => getenv('MOCKSERVER_URL'), 'expectationsPath' => __DIR__ . '/../../docker/mockserver/expectations', @@ -52,7 +52,8 @@ public function testExpectationNotWasCalledThrowException2(): void { $this->expectException(ExpectationFailedException::class); $this->expectExceptionMessage( - 'No expectation found with id not-existing-expectation' . PHP_EOL + 'No expectation found with id not-existing-expectation' . " +" . 'Failed asserting that 400 matches expected 202.' ); $this->sot->seeMockRequestWasCalled('not-existing-expectation'); diff --git a/tests/Integration/SeeMockRequestWasNotCalledTest.php b/tests/Integration/SeeMockRequestWasNotCalledTest.php index 9943770..4cc46a4 100644 --- a/tests/Integration/SeeMockRequestWasNotCalledTest.php +++ b/tests/Integration/SeeMockRequestWasNotCalledTest.php @@ -20,7 +20,7 @@ protected function setUp(): void 'url' => getenv('MOCKSERVER_URL'), 'expectationsPath' => __DIR__ . '/../../docker/mockserver/expectations', ]; - $moduleContainer = $this->createMock(ModuleContainer::class); + $moduleContainer = $this->createStub(ModuleContainer::class); $this->sot = new MockServerHelper($moduleContainer, $config); $this->sot->_initialize(); $this->sot->_beforeSuite(); @@ -54,7 +54,8 @@ public function testExpectationWasCalledNotExistExpectationThrowException(): voi { $this->expectException(ExpectationFailedException::class); $this->expectExceptionMessage( - 'No expectation found with id not-existing-expectation' . PHP_EOL + 'No expectation found with id not-existing-expectation' . " +" . 'Failed asserting that 400 matches expected 202.' ); $this->sot->seeMockRequestWasNotCalled('not-existing-expectation'); From 49f8878e110e7e7c5c135c2478879344851413c8 Mon Sep 17 00:00:00 2001 From: Vizzent Date: Fri, 6 Nov 2026 10:08:10 +0100 Subject: [PATCH 3/4] Fix newline escape in expected test messages Replace the literal line break added in the previous commit with an escaped newline. Co-Authored-By: Claude Opus 5.5 --- tests/Integration/SeeMockRequestWasCalledTest.php | 3 +-- tests/Integration/SeeMockRequestWasNotCalledTest.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/Integration/SeeMockRequestWasCalledTest.php b/tests/Integration/SeeMockRequestWasCalledTest.php index 33b1659..26620fa 100644 --- a/tests/Integration/SeeMockRequestWasCalledTest.php +++ b/tests/Integration/SeeMockRequestWasCalledTest.php @@ -52,8 +52,7 @@ public function testExpectationNotWasCalledThrowException2(): void { $this->expectException(ExpectationFailedException::class); $this->expectExceptionMessage( - 'No expectation found with id not-existing-expectation' . " -" + 'No expectation found with id not-existing-expectation' . "\n" . 'Failed asserting that 400 matches expected 202.' ); $this->sot->seeMockRequestWasCalled('not-existing-expectation'); diff --git a/tests/Integration/SeeMockRequestWasNotCalledTest.php b/tests/Integration/SeeMockRequestWasNotCalledTest.php index 4cc46a4..4579808 100644 --- a/tests/Integration/SeeMockRequestWasNotCalledTest.php +++ b/tests/Integration/SeeMockRequestWasNotCalledTest.php @@ -54,8 +54,7 @@ public function testExpectationWasCalledNotExistExpectationThrowException(): voi { $this->expectException(ExpectationFailedException::class); $this->expectExceptionMessage( - 'No expectation found with id not-existing-expectation' . " -" + 'No expectation found with id not-existing-expectation' . "\n" . 'Failed asserting that 400 matches expected 202.' ); $this->sot->seeMockRequestWasNotCalled('not-existing-expectation'); From e76933dd7d501264e7833e25e6750e06c41964d2 Mon Sep 17 00:00:00 2001 From: Vizzent Date: Fri, 6 Nov 2026 10:11:09 +0100 Subject: [PATCH 4/4] Accept the MockServer 9 verification message in tests MockServer 9 reports a request found more times than expected as "Request found 1 time but should have been found exactly 0 times". The test only accepted the older "Request not found exactly 0 times" wording, so it failed in CI, where the unpinned mockserver/mockserver image now resolves to 9.2.0. Co-Authored-By: Claude Opus 5.5 --- tests/Integration/SeeMockRequestWasNotCalledTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Integration/SeeMockRequestWasNotCalledTest.php b/tests/Integration/SeeMockRequestWasNotCalledTest.php index 4579808..1aa1c56 100644 --- a/tests/Integration/SeeMockRequestWasNotCalledTest.php +++ b/tests/Integration/SeeMockRequestWasNotCalledTest.php @@ -43,7 +43,8 @@ public function testExpectationWasNotCalledButItWasThrowException(): void { $this->expectException(ExpectationFailedException::class); $this->expectExceptionMessageMatches( - '#^Request not found exactly 0 times, expected:((.|\n)*) but was:((.|\n)*)' + '#^Request (?:not found exactly 0 times|found 1 time but should have been found exactly 0 times), ' + . 'expected:((.|\n)*) but was:((.|\n)*)' . 'Failed asserting that 406 matches expected 202\.$#' ); $this->client->request('GET', 'https://jsonplaceholder.typicode.com/posts/2');