Conversation
alongosz
reviewed
Sep 17, 2026
| ->method('createView') | ||
| ->willReturn( | ||
| $this->createMock(FormView::class) | ||
| $this->createStub(FormView::class) |
Member
There was a problem hiding this comment.
Seems we have an inconsistency. An Agent correctly applied in some cases self::createStub but there are ~189 cases with $this->createStub. createStub is static in PHPUnit 11.
Member
|
Side note: code duplication valid, but not fixable within the scope, can be ignored. // sadly there's no tooling in Sonar to temporarily ignore code duplicates, unlike other errors. |
mikadamczyk
reviewed
Sep 17, 2026
ViniTou
force-pushed
the
phpunit-11
branch
2 times, most recently
from
September 17, 2026 10:55
7a09bf7 to
eab59aa
Compare
…ByExpressionTest (cherry picked from commit b3d2551)
|
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.


Description:
phpunit/phpunit^9.5→^11.5,matthiasnoback/symfony-dependency-injection-test^5.0→^6.0, addssymfony/phpunit-bridge^7.4torequire-dev(was only presenttransitively before);
dama/doctrine-test-bundlestays^8.2(already satisfied^8.0).composer.lockis gitignored in this repo; the committedcomposer.lock-equivalent state wasstale (sibling
ibexa/*packages pinned to old resolutions) — a fullcomposer update phpunit/phpunit symfony/phpunit-bridge matthiasnoback/* dama/* --with-all-dependenciesrefreshed the tree, incidentally moving
symfony/http-foundationforward too (see below).phpunit.xmlandphpunit.integration.xmlto the 11.5 schema via--migrate-configurationplus hand fixes: added<extensions><bootstrap class="Symfony\Bridge\PhpUnit\SymfonyExtension"/></extensions>to both, converted theintegration config's DAMA
<extension class="…PHPUnitExtension">to a<bootstrap>entryalongside it, added
cacheDirectory=".phpunit.cache".beStrictAboutTodoAnnotatedTestswassilently dropped by the migration tool (removed attribute in PHPUnit 10). Both configs validate
against
phpunit.xsd. Added.phpunit.cache/to.gitignore(.phpunit.result.cachewasalready present).
PHPUnitSetList::PHPUNIT_100,PHPUNIT_110,ANNOTATIONS_TO_ATTRIBUTESontests/with a temporary config, deleted after) converted 119 files:
@dataProvider/@covers/@groupannotations →
#[DataProvider]/#[CoversClass]/#[Group]attributes, non-static providermethods without
$this-dependencies →static, somecreateMock()→createStub()conversions where no
->expects()followed.composer fix-cscleaned up 11 stray docblockartifacts immediately after.
*Test.phpbase class to*TestCase.php(PHPUnit 11 defaults--fail-on-phpunit-warningto true, and an abstract class matching the runner's test-filenaming pattern otherwise triggers a "no tests found" warning):
BaseActionMenuBuilderTest→BaseActionMenuBuilderTestCase(tests/lib/Menu/Action/, 2 subclasses updated). No deptracbaseline entries referenced its old FQCN.
EmbeddedItemEditFormExtensionTest,FocusModeExtensionTest,LocationExtensionTest) that overrode the old, non-static, deprecatedgetFixturesDir()instead ofTwig\Test\IntegrationTestCase's new staticgetFixturesDirectory()(the abstract base'sgetTests()still falls back to the legacy methodwith a triggered deprecation, per Twig 3.13) — switched all three to override the static method,
matching the two sibling files in the same directory that already did.
ContentTreeChildrenQueryArgumentResolverTest,ContentTranslationMapperTest,UDWBasedValueViewTransformerTest,UserTransformerTest,VersionInfoTransformerTest,VersionListActionMenuBuilderTest+ its shared baseBaseActionMenuBuilderTestCase,LimitationResolverTest,IsProfileAvailableTest,DamWidgetTest) that Rector could not make static because they called$this->-dependenthelpers. Where the helper only built plain value objects or
self::createStub()-based doubles,made the whole call chain
static. Where a double needed configured expectations that also hadto stay identical across the provider and the instance method (
VersionsTabVisibilityTest),switched to a
private static ?Content $exampleContentcache built once viaself::createStub()so both sides reference the same object. Two providers built doubles with real
->with()argument matchers or
->expects()call-count assertions(
UDWBasedValueViewTransformerTest::createLocation,DamWidgetTest's content-type doubles) —Stub'sInvocationStubberhas nowith()(PHPStan-caught), and the assertions were dead codeunder PHPUnit 9 anyway (the provider ran on a throwaway instance, so nothing was ever verified);
replaced both with real
Ibexa\Core\Repository\Values\Content\Location/Ibexa\Core\Repository\Values\ContentType\ContentTypeobjects (real__get/hasFieldDefinitionbehaviour, no mocking needed).
DamWidgetTest's provider static andPHPStan resolving the (now class-string, not doc-comment)
#[CoversClass]attribute: it pointedat
Ibexa\AdminUi\UI\Config\Provider\Module\ImagePicker, a class that does not exist in thistest's own directory — corrected to
DamWidget, the class actually under test.LocationIsNotSubLocationValidatorTest/LocationIsWithinCopySubtreeLimitValidatorTestused theremoved
MockBuilder::setMethodsExcept(['__get']); replaced withonlyMethods(array_values(array_diff(get_class_methods(Location::class), ['__get']))), whichreproduces the old "mock everything except
__get" semantics exactly.SetViewParametersListenerTest: Rector'sWithConsecutiveRectorturned a bare->method('getParameter')->withConsecutive(...)(no->expects(), so no call-count was ever enforced) into->expects($matcher = self::exactly(2))->method(...)->willReturnCallback(...). That sharedsetUp()mock is onlyexercised by 1 of 7 test methods in the class; the other 6 started failing teardown verification
("expected 2 times, actually called 0 times"). Relaxed to
self::any(), preserving the original,pre-Rector behaviour.
Requestfull mocks (getMockBuilder(Request::class)->getMock()inInContextTranslationListenerTest,RequestListenerTest,RequestLocaleListenerTest) thatfatal with "Typed property Request::$attributes must not be accessed before initialization" —
the mock's real constructor calls
$this->initialize(...), which resolves to the mocked(stubbed-to-null)
initialize(), so the typed$attributesproperty is never actually set; thiswas masked before by a stale local
symfony/http-foundationresolution and surfaced once thecomposer bump above refreshed it to the version this branch's
composer.jsonactuallyconstrains. Fixed by assigning
$request->attributes = new ParameterBag();right after buildingeach mock, restoring the pre-existing behaviour without weakening any of the mocks'
expects()assertions.
->will(self::returnCallback(...))→->willReturnCallback(...)(ContentProxyCreateDraftListenerTest),->will(self::returnValue(...))→
->willReturn(...)(ContentTypeFormProcessorTest).: void,: array) to 5willReturnCallbackclosuresRector's
WithConsecutiveRectorleft untyped (PHPStanmissingType.return/Ibexa.requireClosureReturnType),across
AdminUiFormsTest(×3),SubtreeOperationsTest,ContentTypeFormProcessorTest.--display-phpunit-deprecations: 704 tests, 0 failures/errors, 10remaining
getMockForAbstractClass()deprecations across 5 files (deprecated in 12, stillallowed in 11 — matches the recipe's accepted exception; no replacement API exists yet).
Integration:
--list-testsclean, run 35 tests / 34 green — 1 pre-existing, environmental errorunrelated to this migration (
TranslationTest::testTranslationneeds a Node.js@typescript-eslint/typescript-estreeinstall that isn't present locally; reproduces identicallyon
origin/6.0with PHPUnit 9). 6PHPUnit Deprecationsin the integration run ("Metadata foundin doc-comment") come from
ibexa/test-rest's ownBaseRestWebTestCase/WebTestCase@dataProviderdoc-comments — vendor-owned, resolves with theibexa/test-restPHPUnit 11 wavePR, not fixable here.
vendor/bin/phpstan analyse --no-progress: 0 errors (no baseline in this repo, no ignoresadded).
composer check-cs: 0 of 1239 files fixable.vendor/bin/rector process --dry-run --clear-cache: clean (one pre-existing, unrelated deprecated-skip-rule warning present onorigin/6.0too).vendor/bin/deptrac analyse --no-progress: 0 violations, 28 skipped(unchanged from baseline — the renamed abstract base isn't referenced in
deptrac.baseline.yaml). No removed PHPUnit CLI flags (-v/--verbose) incomposer.jsonscripts or CI workflows.
For QA:
N/A
Documentation:
N/A