Skip to content

fix(tests): symfony 8.1 compat#8210

Merged
soyuka merged 1 commit into
api-platform:4.3from
soyuka:fix/symfony-8.1-compat
May 29, 2026
Merged

fix(tests): symfony 8.1 compat#8210
soyuka merged 1 commit into
api-platform:4.3from
soyuka:fix/symfony-8.1-compat

Conversation

@soyuka
Copy link
Copy Markdown
Member

@soyuka soyuka commented May 29, 2026

Summary

Restores HttpCache / Hydra / JsonApi / Symfony Bundle PHPUnit jobs and PHPStan against Symfony 8.1.0:

  • ResponseHeaderBag and ParameterBag became final in Symfony HttpFoundation 8.1.0. createMock() on a final class triggers a fatal in PHPUnit 12. Swap the mocks in AddTagsProcessorTest, HydraLinkProcessorTest, JsonApiProviderTest and MercureLinkProcessorTest for real instances and assert on bag state after the call. Behaviour identical, assertions tightened (now verify the actual stored value instead of expects(...)->method('set')).
  • Symfony Console 8.1.0 removed Application::add(). The fallback branch in DebugResourceCommandTest::getCommandTester() is unreachable on Symfony ≥ 7.4 but must be kept for Symfony 6.4 support. Add a targeted phpstan.neon.dist ignore (reportUnmatched: false) so analysis passes on both Symfony 6.4 and 8.1.

Test plan

  • vendor/bin/phpunit src/HttpCache/Tests src/Hydra/Tests src/JsonApi/Tests tests/Symfony/Bundle/Command/DebugResourceCommandTest.php tests/Symfony/State/MercureLinkProcessorTest.php — green locally on Symfony 7.4
  • vendor/bin/phpstan analyse — no errors
  • CI green on Symfony 8.1.0 across the four PHPUnit components (http-cache, hydra, json-api, state) and the PHPStan job

@soyuka soyuka force-pushed the fix/symfony-8.1-compat branch 3 times, most recently from 3422a20 to 53d4b47 Compare May 29, 2026 13:34
@soyuka soyuka force-pushed the fix/symfony-8.1-compat branch from 53d4b47 to 45bc35a Compare May 29, 2026 13:43
@soyuka soyuka merged commit 30f1f97 into api-platform:4.3 May 29, 2026
118 of 120 checks passed
@soyuka soyuka deleted the fix/symfony-8.1-compat branch May 29, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant