Repository navigation
test(openapi): fix factory test for phpunit 13 - #8567
Merged
soyuka merged 1 commit intoSep 23, 2026
Merged
Conversation
This test code came from 4.4 through the up-merge and only compiled there. PHPUnit 13, now on 5.0, no longer exposes with() on what method() returns for a stubbed double, so the five filter-locator doubles move to createStub plus willReturnMap. They assert nothing about being called, so createStub was always the right tool. DefinitionNameFactory::__construct was removed on 5.0, so the helper no longer passes an argument to it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHPStan (PHP 8.5)is currently red on5.0itself. This fixes it. 11 errors, one file,two independent causes, both from test code that only ever compiled on
4.4.I introduced this. #8562 landed on
4.4green, and my4.4→5.0merge-up (81f2cdfe9)carried it across with no textual conflict.
InvocationStubber::with(), 10 errors5.0runs PHPUnit 13 since #8537, which changed whatmethod()returns on a stubbeddouble, so
with()is gone from it. The five filter-locator doubles move tocreateStubplus
willReturnMap, matching the pattern the phpunit 13 migration already used insrc/State/Tests/CallableProcessorTest.php.Worth noting these doubles assert nothing about being called, so
createStubwas thecorrect tool all along and
createMockwas the wrong one before PHPUnit 13 ever made it anerror.
DefinitionNameFactory, 1 error__construct(?array $distinctFormats = null)exists on4.4and was removed on5.0. Thehelper no longer passes an argument. No other call site under
src/OpenApi/Tests/passesone.
Verification
PHPStan on the file: 11 errors before,
[OK] No errorsafter. The before state wasconfirmed by swapping in the
upstream/5.0copy of the file rather than inferred.All six affected tests pass individually.
Not addressed
Three untouched
createMock()calls in the same helper raise a PHPUnit 13 noticerecommending
createStub. They are notices, not errors, and PHPStan does not flag them, sothey are left out to keep this fix minimal while
5.0is red. Worth a follow-up cleanup.