fix(test): restore main CI after the ApiTestCase extraction - #8526
Merged
Conversation
api-platform#7887 moved the test helpers to ApiPlatform\Test and deleted src/Symfony/Bundle/Test. 11 test files still referenced the old FQCN, either merged on main after api-platform#7887 or brought up from 4.3/4.4. The resulting fatal took down the whole PHPUnit matrix and PHPStan. Also stubs getFunction('csp_nonce') on the Twig double in EntrypointActionTest: api-platform#8310 updated GraphiQlActionTest but missed this one, which builds the same GraphiQlAction.
api-platform#7887 moved eight public classes out of api-platform/symfony without a deprecation path, so user test suites extending ApiTestCase break on a plain "class not found". Restore them at the old FQCNs as deprecated shims delegating to ApiPlatform\Test. Client, Response, ArraySubset and MatchesJsonSchema are final and cannot be subclassed, so they are class_alias'd; the traits are wrapped; ApiTestCase subclasses. Adds api-platform/test and symfony/deprecation-contracts to the component requirements.
CS Fixer's fully_qualified_strict_types applies to docblocks, so the
{@see} tags must use the imported alias. PHPStan reports trait.unused
for the three trait shims, which exist only for BC and are legitimately
used nowhere in the monorepo.
api-platform#8517 removed the Request::getContentType() fallbacks and the method_exists() guards around getContentTypeFormat(), but kept the ignore patterns targeting them, so phpstan reports them as unmatched. Neither has a call site left.
soyuka
added a commit
that referenced
this pull request
Sep 11, 2026
#8526 added api-platform/test to require, but it pulls phpunit ^11.5 || ^12.2 into every production install and breaks the Guides job, whose docs/composer.json pins phpunit ^10. 4.4 keeps phpunit in require-dev while still shipping the same helpers; the shims only load from test code, so require-dev plus a suggest entry matches that precedent. Claude-Session: https://claude.ai/code/session_01FmRmcWx8J7PS374edGFBdE
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.
main is currently red: 24 failing jobs on
c587c81e0. Two distinct causes, both from PRs merged earlier today on stale CI runs — neither is merge-up damage. The merge-up simply made main complete a CI run for the first time since150911ef7.1.
ApiTestCaseFQCN fatal — takes down the whole matrix#7887 moved the test helpers to
ApiPlatform\Testand deletedsrc/Symfony/Bundle/Test/. 11 files still used the old FQCN — some merged on main after #7887 (#8283, #8310, #7870, #8491), some brought up from 4.3/4.4 (#8451, #8505, #8416, #8521, #8508), where the old FQCN is still correct. One fatal killed every PHPUnit job and PHPStan.2. GraphiQL
csp_noncedouble — graphql x4#8310 made
GraphiQlActionask Twig forcsp_nonceand updatedGraphiQlActionTest, but missedEntrypointActionTest, which builds the same action.3. Deprecated BC shims (the structural part)
#7887 moved eight public classes with no deprecation path. Users extend
ApiTestCasein their own suites, so they hit a bare "class not found" on upgrade. It also breaks every merge-up:Without a shim this recurs on every merge-up until 4.4 reaches EOL. The shims restore all eight at the old FQCNs, each emitting
trigger_deprecation:ApiTestCase— abstract, subclassedClientTrait,ApiTestAssertionsTrait,Constraint\ArraySubsetTrait— traits, wrapped viauseClient,Response,Constraint\ArraySubset,Constraint\MatchesJsonSchema— final, soclass_alias(they cannot be subclassed)Verified at runtime through the real autoloader, not just
php -l: all 5 classes resolve to their new counterparts and all 3 traits exist.api-platform/testandsymfony/deprecation-contractsare added tosrc/Symfony/composer.json, which previously declared neither.Note on the strict deprecation job
PHPUnit (no deprecations)runsmax[self]=0. Nothing fires today since main's own tests now use the new FQCN. A future merge-up that brings an old-FQCN file will trip that job rather than fataling the whole suite — a better failure mode, but it still wants the FQCN rewritten on merge-up.ignoreFile=./tests/.ignored-deprecationsis available if you'd prefer to silence it.Unrelated, spotted while here
api-platform/testis not in the CI component matrix inci.yml(18 components listed, it isn't one). It ships — it's in the rootreplaceand matched by the pmu glob — but is never tested in isolation. Same gapeb6bd572bhad to fix for MCP. Not addressed here.