Skip to content

IBX-12606: Migrated the test suites to PHPUnit 11 - #46

Merged
konradoboza merged 1 commit into
6.0from
phpunit-11
Sep 17, 2026
Merged

konradoboza merged 1 commit into
6.0from
phpunit-11

Conversation

@ViniTou

@ViniTou ViniTou commented Sep 15, 2026

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-12606

Description:

  • Migrates ibexa/core-persistence from PHPUnit 9 to PHPUnit 11, part of the DXP 6.0 org-wide PHPUnit 11 wave.
  • phpunit/phpunit require-dev ^9.0 -> ^11.5. dama/doctrine-test-bundle already ^8.2 (unchanged); no matthiasnoback/* deps in this repo.
  • phpunit.xml.dist and phpunit.integration.xml migrated to the 11.5 schema: <listeners><listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/></listeners> replaced with <extensions><bootstrap class="Symfony\Bridge\PhpUnit\SymfonyExtension"/></extensions>; the integration config's DAMA <extension class="...PHPUnitExtension"> converted to a second <bootstrap> entry in the same <extensions> block; dropped beStrictAboutTodoAnnotatedTests/verbose (removed in PHPUnit 10); added cacheDirectory=".phpunit.cache".
  • Rector (PHPUnitSetList::PHPUNIT_100, PHPUNIT_110, ANNOTATIONS_TO_ATTRIBUTES, temp config, deleted after): @covers/@dataProvider doc-comments -> #[CoversClass]/#[DataProvider] attributes (6 files); 4 createMock() -> createStub() conversions where the double is only ever used as a constructor/call argument with no ->expects()/->method() on it directly (hand-verified per site, all safe). No setMethods(/withConsecutive(/->at(/assertObjectHasAttribute/getInvocationCount in this repo (confirmed absent by full rg over src/ + tests/).
  • Hand-fixed 6 attributes Rector emitted as FQCN (#[\PHPUnit\Framework\Attributes\CoversClass(...)] / DataProvider(...)) down to short form with a use PHPUnit\Framework\Attributes\...; import, per house style.
  • tests/bundle/Gateway/ExpressionVisitorTest.php::configureFieldInMetadata(): @param array<string> $fields -> @param list<string> $fields — PHPUnit 11's real Assert::logicalOr() carries @no-named-arguments, and PHPStan now rejects spreading a possibly-string-keyed array into it (was silently unchecked under PHPUnit 9's stubs).
  • phpstan-baseline.neon: updated one stale entry's expected type from PHPUnit\Framework\MockObject\MockObject to PHPUnit\Framework\MockObject\Stub (consequence of the createMock->createStub conversion in the same file); no ignores added.
  • Unrelated pre-existing bug found and fixed while getting PHPStan clean: tests/integration/Gateway/ExpressionVisitorTest.php::setUp() built $this->articleExpressionVisitor with only 5 constructor args (6 required) — a real bug independent of PHPUnit, never caught before because the integration suite can't run locally (see Verification note below) and PHPStan wasn't clean on this repo prior to the dependency refresh in this PR. Added the missing $connection argument.
  • .gitignore: added /.phpunit.cache/ (/.phpunit.result.cache was already present).
  • Local dependency-resolution fixup (not a code change): this repo's local composer.lock/vendor were stale from a previous branch checkout (ibexa/core, ibexa/doctrine-schema, ibexa/test-core all pinned to dev-dbal-4-upgrade, gitignored so git checkout doesn't reset them) and blocked composer update outright with "Root composer.json requires ... found ...[dev-dbal-4-upgrade] but it does not match the constraint." Included those three packages in the same composer update ... --with-all-dependencies call to re-resolve them onto 6.0.x-dev; no composer.json/composer.lock changes result from this beyond the intended PHPUnit bump (composer.lock isn't git-tracked in this repo).

For QA:

N/A

Documentation:

N/A

Verification

  • vendor/bin/phpunit -c phpunit.xml.dist --display-phpunit-deprecations: 34 tests, 133 assertions, 0 failures. 27 deprecations, all MockBuilder::getMockForAbstractClass() (allowed for PHPUnit 11, removed without replacement in 12). Before Rector: same 34 tests green, 32 deprecations (27 getMockForAbstractClass + 5 "Metadata found in doc-comment").
  • vendor/bin/phpunit -c phpunit.integration.xml: bootstrap fails with UNIQUE constraint failed: ibexa_content_field.id — this is the documented org-wide IBX-12530 regression in ibexa/test-core@38b1f96 (DatabaseSchemaHook/SchemaBuilder), reproduced identically on other repos in this wave and orthogonal to this PHPUnit migration. Treated as informational per the wave plan, not a merge gate.
  • vendor/bin/phpstan analyse --no-progress: no errors (one real test-code fix + one baseline type update, both described above; no ignores added).
  • composer check-cs: clean, 0 of 48 files need changes.
  • vendor/bin/rector process --dry-run (repo's own rector.php, no PHPUnit sets, re-run with --debug to rule out a stale-cache false zero): clean — [OK] Rector is done!; only a pre-existing, unrelated warning about a deprecated skipped rule (SimplifyFormRenderingRector), present before this migration too.

@konradoboza
konradoboza merged commit 2cffce9 into 6.0 Sep 17, 2026
11 checks passed
@konradoboza
konradoboza deleted the phpunit-11 branch September 17, 2026 06:34
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.

4 participants