IBX-12606: Migrated the test suites to PHPUnit 11 - #71
Merged
Merged
Conversation
konradoboza
approved these changes
Sep 17, 2026
|
tbialcz
approved these changes
Sep 17, 2026
wiewiurdp
approved these changes
Sep 17, 2026
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.



Note
The red
Run code style checkjob fails in its PHPStan step on a pre-existing error insrc/lib/Mapper/PagerSearchContentToDataMapper::setTranslatedContentTypesNames()(array-shape mismatch) that is identical onorigin/6.0with PHPUnit 9; not introduced here.Description:
phpunit/phpunit^9.6→^11.5andmatthiasnoback/symfony-dependency-injection-test^5.0→^6.0incomposer.jsonrequire-dev.symfony/phpunit-bridgeanddama/doctrine-test-bundleare not dependencies of this repo, so left untouched (not force-added).Local vendor/lock was stale (still resolving
ibexa/core/ibexa/doctrine-schema/ibexa/rectorat5.0.x-devdespite composer.json requiring~6.0.x-dev), so a fullcomposer update(not apartial one scoped to the phpunit packages) was required to resolve cleanly; this also
incidentally fixed most of the pre-existing PHPStan baseline drift (see below).
phpunit.xmlto the PHPUnit 11.5 schema via--migrate-configurationplus hand review:drops
convert*ToExceptions/backupStaticAttributes(renamed tobackupStaticProperties), old<filter><whitelist>converted automatically to<source><include>/<exclude>, addscacheDirectory=".phpunit.cache". This repo had no<listeners>block and nosymfony/phpunit-bridgedependency to begin with, so no<extensions>block was needed/added..phpunit.cache/to.gitignore(the pre-existing.phpunit.result.cacheentry was alreadythere).
PHPUnitSetList::PHPUNIT_100,PHPUNIT_110,ANNOTATIONS_TO_ATTRIBUTESvia a temporaryconfig, deleted after use) touched 5 files: converted 2
@dataProviderannotations and 1@covers-with-value annotation to attributes, made 1 data-provider method static, and converted 5createMock()calls tocreateStub()where the double was only used as a constructor/callargument with no
expects()/argument matching configured (verified safe, no reverts needed there).use PHPUnit\Framework\Attributes\{CoversClass,DataProvider};imports added and the FQCNattributes shortened, in
SuggestionParserTest.phpandSearchQueryTypeTest.php.SearchQueryTypeTest::dataProviderForGetQuery()used$this->to build fixture data including aUsermock (needed as PHPUnit 11 hard-errors on non-static providers). Made the provider and allits helper methods (
createSearchDataWithAllCriteria,createContentTypesList,createExpectedQueryForAllCriteria,createExpectedAggregations,createUser) static.createUser()'s double needed->method('__get')->with('id')->willReturn($id), but PHPUnit 11'sStub-returnedInvocationStubberhas nowith()(argument matching isMockObject-only);Rector's
CreateStubOverCreateMockArgRectorhad wrongly converted this one. Fixed by keeping iton the
StubAPI but replacing->with()with awillReturnCallbackthat checks the propertyname itself, instead of reverting to a full
createMock()(which would have been unusable fromthe now-static method anyway).
SearchQueryTypeTest::$sortingDefinitionRegistryproperty:PropertyCreateMockToCreateStubRectorhad narrowed its declared type from
SortingDefinitionRegistryInterfaceto barePHPUnit\Framework\MockObject\Stub, which broke PHPStan where the property is passed toSearchQueryType's constructor (still typed with the interface). Reverted the declared type toSortingDefinitionRegistryInterface, kept theStub-intersection PHPDoc hint.setMethods(,withConsecutive(,->at(/self::at(,assertObjectHasAttribute,getMockForAbstractClass, abstract*Test.phpbase classes, integration PHPUnit config, ordeptrac config exist anywhere in this repo (confirmed by full-population
rgsweep of all 17 testfiles, not sampled) — so those recipe steps are no-ops here.
composer fix-csmade no changes (no stray docblock artifacts from the Rector pass, cs-fixer's ownhook kept files clean throughout).
phpstan-baseline.neonneeded no pruning: 17 pre-migration errors were almost entirely stale-vendorartifacts against outdated upstream
ibexa/core/Symfony types (fixed once vendor was properlyupdated to the
~6.0.x-devthe repo actually requires); the 1 remaining error(
PagerSearchContentToDataMapper.php:179, a by-ref array-shape mismatch) is pre-existing,unrelated to this migration, and present identically before and after.
For QA:
N/A
Documentation:
N/A