Skip to content

fix(test): support symfony/mercure 0.8 in test fixtures - #8458

Merged
soyuka merged 1 commit into
api-platform:4.3from
soyuka:fix/mercure-0.8-testhub
Aug 16, 2026
Merged

fix(test): support symfony/mercure 0.8 in test fixtures#8458
soyuka merged 1 commit into
api-platform:4.3from
soyuka:fix/mercure-0.8-testhub

Conversation

@soyuka

@soyuka soyuka commented Aug 16, 2026

Copy link
Copy Markdown
Member

Unblocks 4.3 CI, which has produced no test signal since 2026-07-08.

What broke

symfony/mercure v0.8.0 was released 2026-08-11 and added two methods to HubInterface:

public function getProtocolVersion(): ProtocolVersion;   // v0.8.0 src/HubInterface.php:46
public function getCookieName(): string;                 // v0.8.0 src/HubInterface.php:51

tests/Fixtures/TestBundle/Mercure/TestHub.php is a decorator implementing HubInterface and did not define them:

PHP Fatal error: Class ApiPlatform\Tests\Fixtures\TestBundle\Mercure\TestHub contains 2 abstract
methods and must therefore be declared abstract or implement the remaining methods
(Symfony\Component\Mercure\HubInterface::getProtocolVersion, ...::getCookieName)

This kills the container at cache warmup, so all 20 failing jobs died before PHPUnit started — zero tests ran. It is entirely test infrastructure: nothing in src/ implements HubInterface, and no shipped code is affected.

It landed silently because symfony/mercure-bundle was declared as "*" in all four composer files — a bare wildcard on a 0.x component.

What changed

  1. TestHub implements both new methods, delegating to the inner hub.
  2. "symfony/mercure-bundle": "*""^0.4.3|^0.5" in composer.json, src/GraphQl/composer.json, src/Serializer/composer.json, src/Symfony/composer.json. All four are require-dev; the suggest entry in src/Symfony/composer.json is untouched.

The constraint deliberately spans the breaking boundary so both majors stay covered:

mercure-bundle resolves symfony/mercure
v0.4.3 ^0.6.1|^0.7 — what the lowest jobs install
v0.5.0 ^0.8

ProtocolVersion does not exist before 0.8. Declaring it as a return type is safe because PHP resolves return types lazily and nothing calls these methods on older versions — but that is an assumption worth testing rather than trusting, so it was tested.

Verification

Both majors, cache warmup plus the Mercure functional tests:

symfony/mercure ProtocolVersion present cache:warmup phpunit tests/Functional --filter Mercure
v0.7.2 no OK OK (6 tests, 30 assertions)
v0.8.0 yes OK OK (6 tests, 30 assertions)

php-cs-fixer: no changes. PHPStan on the changed fixture: no errors.

Note

Branches 4.4 and main carry the identical TestHub and the same "*" constraint. 4.4 last ran CI on 2026-07-12, before mercure 0.8.0, so it has not detonated yet — it will on the next push. This should merge up rather than be fixed separately.

symfony/mercure 0.8.0 (2026-08-11) added getProtocolVersion() and getCookieName() to HubInterface.
The TestHub decorator did not implement them, so every CI job died at container warmup before a
single test ran -- 20 jobs red on 4.3, with no green run since 2026-07-08.

symfony/mercure-bundle was declared as "*" in all four composer.json files, which let a breaking
0.x release land unannounced. Constrain it to ^0.4.3|^0.5 so both majors stay covered: 0.4.3
resolves mercure ^0.6.1|^0.7 for the lowest jobs, 0.5.0 resolves ^0.8.

ProtocolVersion does not exist before 0.8, but PHP resolves return types lazily and nothing calls
these methods on older versions. Verified: cache warmup and the Mercure functional tests pass under
both 0.7.2 and 0.8.0.
@soyuka
soyuka merged commit 76bad10 into api-platform:4.3 Aug 16, 2026
102 of 112 checks passed
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