Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.
88839[WIP][TASK] Reset `GeneralUtility::$container` in unit tests
Commit message
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 1
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/39/88839/1 && git checkout FETCH_HEAD - Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/39/88839/1 && git cherry-pick FETCH_HEAD
Review
-
Code review CR 0 Needs a vote
-
Verified V 0 Needs a vote
- core-ci +1 CI
Files 9
- typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/TypoLinkSoftReferenceParserTest.php+7 −0
- typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/TypoLinkTagSoftReferenceParserTest.php+7 −0
- typo3/sysext/core/Tests/Unit/LinkHandling/LinkServiceTest.php+7 −0
- typo3/sysext/core/Tests/Unit/Site/Entity/SiteTest.php+7 −0
- typo3/sysext/frontend/Tests/Unit/ContentObject/CaseContentObjectTest.php+7 −0
- typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php+7 −0
- typo3/sysext/frontend/Tests/Unit/ContentObject/ImageContentObjectTest.php+7 −0
- typo3/sysext/frontend/Tests/Unit/Processor/GalleryProcessorTest.php+7 −0
- typo3/sysext/frontend/Tests/Unit/Typolink/AbstractTypolinkBuilderTest.php+7 −0
Review log 56
-
Stefan Bürk uploaded patch set 1 03/30/25, 14:04
-
Stefan Bürk wrote 03/30/25, 14:06
Hashtag added: lolli-feedback -
core-ci voted on patch set 1 V +1 03/30/25, 14:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76668
-
Benjamin Franzke commented on patch set 1 03/30/25, 17:05
Can we transform tests that need to set a container to functional tests? Another option would be to fix them to use DI and provide the services via injection… I think `GeneralUtility::setContainer()` should ideally be forbidden in Unit tests and should have never been created in unit tests… It is an internal method and is not meant to be used in tests (tests should not rely on internal API). Not because I want to annoy people, but simply because it's too easy to miss where a mocked dependency is "automatically" used. I don't want extension authors to copy this anti-pattern therefore I also don't think that we should provide cleanups in testing framework.Simple alternative: ``` git grep -r GeneralUtility::setContainer typo3/sysext/*/Tests/Unit ``` -
Stefan Bürk commented on patch set 1 03/30/25, 20:50
Reply
> I don't want extension authors to copy this anti-pattern therefore I also don't think that we should provide cleanups in testing framework. Me neither. But the question is, if we should add it as integration test stating it / failing tests eventually with the message that this test should be converted to a functional. However, thanks for your input on this. The current test is not ment to be done in that way and was just to investigate the failure and see the current impact as base for discussions.Reply
Yes, but again - the "code" also acted as base for discusson if we want to add that as integration test into the TF (done here manually), with a adjusted message, so extension/project developers are made aware of this fact (and recommend replacing the test with a functional test instead). -
Stefan Bürk marked it work in progress 04/24/25, 15:36