Skip to content

re #209 test: upgrade PHPUnit 11 → 12 and paratest 7.8 → 7.20 - #226

Merged
tonydspaniard merged 1 commit into
masterfrom
feat/209-phpunit-12
Jun 6, 2026
Merged

re #209 test: upgrade PHPUnit 11 → 12 and paratest 7.8 → 7.20#226
tonydspaniard merged 1 commit into
masterfrom
feat/209-phpunit-12

Conversation

@tonydspaniard

Copy link
Copy Markdown
Member

Part of #209 (does not close it). Upgrades the test toolchain one major version while keeping the framework's PHP 8.3 floor.

Why PHPUnit 12, not 13

Both PHPUnit 13 and paratest 7.22+ require PHP ≥ 8.4.1, so the literal "11 → 13" from #209 would force dropping PHP 8.3 (a breaking change / positioning decision). PHPUnit 12 (PHP ≥ 8.3) + paratest 7.20 (php 8.3||8.4||8.5, phpunit ^12.5||^13) is the ceiling that preserves 8.3 and still advances paratest 12 minors (7.8.5 → 7.20.0). The full 13 jump is deferred to a separate decision on the 8.3 floor.

Resolves to: phpunit/phpunit 12.5.29, phpunit/php-code-coverage 12.5.7, brianium/paratest 7.20.0.

Constraint bumps (^11.4^12.5, paratest ^7^7.20)

  • composer.json (require-dev)
  • src/Altair/TestReporter/composer.json (the published reporter package)
  • both bin/altair-generated skeleton composer.json files

PHPUnit 12 breakages fixed

  1. Config aborts the run with no coverage driver. PHPUnit 12 prints "No tests executed" when a <coverage> report is configured but pcov/xdebug is absent. Removed the redundant <coverage><clover> block from phpunit.xml.dist — CI passes --coverage-clover coverage.xml on the CLI, so the block was duplicative and only broke driverless local runs. <source> is kept (coverage scope + restrictNotices/restrictWarnings).
  2. 13 deprecations"Using with() on a test stub has no effect and is deprecated."* Removed the no-op with() argument-matchers from createStub() doubles in 4 Cookie/FormatNegotiator tests (they assert on output, not interaction). Dropped two now-unused imports.
  3. 12 notices"No expectations were configured for the mock object … use a test stub instead." Converted expectation-less createMock() / getMockBuilder() doubles to createStub() in CycleEntityManagerTest, CycleReadModelRepositoryTest, DispatcherMiddlewareTest, SessionBlockTest (the two mocks that do call expects() are left as mocks).

Verification

  • Full suite green on PHPUnit 12.5.29: 6557 tests, 0 failures / 0 warnings / 0 deprecations / 0 notices. The only errors/skips are environment-gated (ext-mongodb/ext-redis absent locally; they pass on CI).
  • The published test-reporter AltairExtension loads on PHPUnit 12 and emits a valid JSON report (result: pass, correct totals) — the Extension + event-subscriber API is unchanged.
  • paratest 7.20.0 runs the suite in parallel.
  • composer cs + composer stan (level 8, no baseline) + composer rector (whole-tree dry-run) all clean.

Docs

PHPUnit 11 → 12 across README.md, AGENT.md, CLAUDE.md, docs/README.md, docs/packages/{common,middleware,test-reporter}.md, the skeleton README.md, and the attributes doc URL (en/11.4/en/12.5/). Corrected the test-reporter event-system floor to "PHPUnit 11 or earlier".

Test plan

  • vendor/bin/phpunit (PHPUnit 12.5.29) — green except env-gated cases
  • vendor/bin/paratest --no-coverage — green
  • test-reporter Extension smoke test → valid JSON report
  • composer cs / composer stan / composer rector — clean
  • CI: 8.3 + 8.4 matrix, Static Analysis, Determinism gate

Part of #209. Bumps the test toolchain a major version while keeping the
framework's PHP 8.3 floor. PHPUnit 13 and paratest 7.22+ both require PHP
>= 8.4.1, so the full "11 -> 13" jump is deferred until a separate decision
to drop PHP 8.3; PHPUnit 12 (PHP >= 8.3) + paratest 7.20 (php 8.3||8.4||8.5,
phpunit ^12.5||^13) is the ceiling that preserves 8.3 and still moves paratest
forward 12 minors.

Constraints (phpunit ^11.4 -> ^12.5, paratest ^7 -> ^7.20):
- composer.json (require-dev), src/Altair/TestReporter/composer.json,
  and both bin/altair-generated skeleton composer.json files.
- Resolves to phpunit 12.5.29, php-code-coverage 12.5.7, paratest 7.20.0.

PHPUnit 12 fixes:
- phpunit.xml.dist: drop the redundant <coverage><clover> block. PHPUnit 12
  aborts the whole run ("No tests executed") when a coverage report is
  configured but no driver (pcov/xdebug) is present; CI passes
  --coverage-clover on the CLI, so the config block was redundant and only
  broke local runs without a driver. <source> is retained for coverage scope
  and restrictNotices/restrictWarnings.
- 13 "Using with*() on a test stub has no effect and is deprecated": removed
  the no-op with() argument-matchers from createStub() doubles in 4 Cookie /
  FormatNegotiator tests (these assert on output, not interaction).
- 12 "No expectations were configured for the mock object ... use a test stub
  instead": converted expectation-less createMock() / getMockBuilder() doubles
  to createStub() in CycleEntityManagerTest, CycleReadModelRepositoryTest,
  DispatcherMiddlewareTest, SessionBlockTest (kept the two mocks that do call
  expects()).

Verified on PHPUnit 12.5.29: full suite green (only env-gated Mongo/Redis
errors/skips that pass on CI), the test-reporter AltairExtension emits a
valid JSON report, and paratest 7.20 runs. cs + stan (level 8) + rector clean.

Docs: PHPUnit 11 -> 12 across README, AGENT.md, CLAUDE.md, docs/*, skeleton
README, and the test-reporter package reference (constraint + event-system
floor).
@tonydspaniard
tonydspaniard merged commit 912f34b into master Jun 6, 2026
4 checks passed
@tonydspaniard
tonydspaniard deleted the feat/209-phpunit-12 branch June 6, 2026 18:52
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