84386[TASK] Reduce GU::makeInstance calls in Unit Tests
Commit message
Review
-
Code review CR +2 Done
- Benjamin Franzke +2
- Oliver Klee +1
-
Verified V +2 Done
- Benjamin Franzke +2
- Oliver Klee +1
Issues 1
Files 30
- typo3/sysext/backend/Tests/Unit/CodeEditor/Registry/AddonRegistryTest.php+4 −5
- typo3/sysext/backend/Tests/Unit/CodeEditor/Registry/ModeRegistryTest.php+4 −5
- typo3/sysext/core/Tests/Unit/Authentication/Mfa/Provider/RecoveryCodesTest.php+1 −2
- typo3/sysext/core/Tests/Unit/Authentication/Mfa/Provider/TotpTest.php+12 −10
- typo3/sysext/core/Tests/Unit/Authentication/IpLockerTest.php+2 −3
- typo3/sysext/core/Tests/Unit/Configuration/CKEditor5MigratorTest.php+1 −6
- typo3/sysext/core/Tests/Unit/Configuration/SiteWriterTest.php+3 −3
- typo3/sysext/core/Tests/Unit/Database/Query/Restriction/AbstractRestrictionTestCase.php+1 −2
- typo3/sysext/core/Tests/Unit/Imaging/IconProvider/BitmapIconProviderTest.php+1 −2
- typo3/sysext/core/Tests/Unit/Imaging/IconProvider/SvgIconProviderTest.php+1 −1
- typo3/sysext/core/Tests/Unit/Imaging/IconProvider/SvgSpriteIconProviderTest.php+1 −1
- typo3/sysext/core/Tests/Unit/LinkHandling/LinkServiceTest.php+4 −4
- typo3/sysext/core/Tests/Unit/LinkHandling/TypoLinkCodecServiceTest.php+6 −7
- typo3/sysext/core/Tests/Unit/Log/Processor/AbstractProcessorTest.php+1 −2
- typo3/sysext/core/Tests/Unit/Log/Writer/FileWriterTest.php+6 −20
- typo3/sysext/core/Tests/Unit/Log/Writer/RotatingFileWriterTest.php+10 −12
- typo3/sysext/core/Tests/Unit/Messaging/Renderer/BootstrapRendererTest.php+6 −8
- typo3/sysext/core/Tests/Unit/Messaging/Renderer/ListRendererTest.php+6 −9
- typo3/sysext/core/Tests/Unit/Messaging/Renderer/PlaintextRendererTest.php+6 −9
- typo3/sysext/core/Tests/Unit/Messaging/FlashMessageRendererResolverTest.php+1 −3
Show 10 more files
- typo3/sysext/core/Tests/Unit/MetaTag/GenericMetaTagManagerTest.php+3 −1
- typo3/sysext/core/Tests/Unit/Page/AssetCollectorTest.php+1 −2
- typo3/sysext/core/Tests/Unit/Page/AssetRendererTest.php+16 −20
- typo3/sysext/core/Tests/Unit/Type/File/ImageInfoTest.php+4 −4
- typo3/sysext/dashboard/Tests/Unit/DashboardPresetRegistryTest.php+1 −4
- typo3/sysext/dashboard/Tests/Unit/WidgetGroupRegistryTest.php7+1 −23
- typo3/sysext/form/Tests/Unit/Mvc/Persistence/FormPersistenceManagerTest.php+1 −1
- typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php+2 −1
- typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php6+5 −5
- typo3/sysext/frontend/Tests/Unit/ContentObject/ImageContentObjectTest.php+4 −4
Review log 2636
Show 611 earlier messages
-
Anja Leichsenring uploaded patch set 1 05/24/24, 13:37
-
core-ci voted on patch set 1 V +1 05/24/24, 13:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58164
-
Anja Leichsenring uploaded patch set 2
V +105/24/24, 14:03 -
core-ci voted on patch set 2 V -1 05/24/24, 14:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58165
-
Anja Leichsenring uploaded patch set 3
V -105/24/24, 14:57 -
core-ci voted on patch set 3 V +1 05/24/24, 15:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58166
-
Anja Leichsenring uploaded patch set 4
V +105/24/24, 15:14 -
core-ci voted on patch set 4 V +1 05/24/24, 15:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58167
-
Anja Leichsenring uploaded patch set 5
V +105/24/24, 15:40 -
Anja Leichsenring uploaded patch set 6 05/24/24, 15:42
-
core-ci voted on patch set 5 V -1 05/24/24, 15:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58168
-
core-ci voted on patch set 6 V -1 05/24/24, 15:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58169
-
Anja Leichsenring rebased onto patch set 7
V -105/28/24, 05:09 -
core-ci voted on patch set 7 V -1 05/28/24, 05:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58376
-
Anja Leichsenring uploaded patch set 8
V -105/28/24, 06:49 -
Anja Leichsenring updated the commit message in patch set 9 05/28/24, 06:50
-
core-ci voted on patch set 8 V +1 05/28/24, 06:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58378
-
core-ci voted on patch set 9 V +1 05/28/24, 06:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58379
-
Benjamin Franzke commented on patch set 9 CR -1 05/28/24, 07:10
-
Anja Leichsenring commented on patch set 9 05/28/24, 07:12
WidgetGroupRegistryTest.php:88Replythis test is rather useless as it tests the execution of Singleton Pattern implementation. We can rely on the framework to take care of the basic stuff. -
Benjamin Franzke commented on patch set 9 CR +1 V +1 05/28/24, 07:18
WidgetGroupRegistryTest.php:88ReplyAcknowledged -
Oliver Klee voted on patch set 9 V +1 05/28/24, 08:48
-
Oliver Klee commented on patch set 9 05/28/24, 08:52
WidgetGroupRegistryTest.php:88ReplyI propose we replace the removed test with a test `isSingleton` that checks that the class is an instance of `SingletonInterface`.ContentObjectRendererTest.php:147Could we use a non-mocked instance here? -
Anja Leichsenring commented on patch set 9 05/28/24, 11:17
WidgetGroupRegistryTest.php:88Replyit's a core class and under control. A lot of things would break if it is no singleton, so why burden the unit tests with it?ContentObjectRendererTest.php:147Replywhy should we? It is a dependency, that does absolutely nothing but satisfying the surrounding code. No need to expand the system under test. -
Oliver Klee commented on patch set 9 05/28/24, 11:33
WidgetGroupRegistryTest.php:88ReplyFirst of all, I don't consider additional tests a burden, but something of value. And I agree that probably other things would break if this class was no singleton. Still, in my experience having direct tests for a property/behavior of a class makes hunting down bugs easier (because then the test for the cause of the problem fails, not only other tests down the line).ContentObjectRendererTest.php:147ReplyI personally have gone from "mock all dependencies" to "only mock the dependencies where either it doesn't work with a mock, or where the dependency does not have much behavior" to keep things simpler while not creating new problems. (In my extensions, those are usually domain models that I don't mock, as opposed to services or repositories which I almost always mock in unit tests.) This would be consistent with other places in our unit tests where we use a direct `Context` instance of mocking it. -
Oliver Klee commented on patch set 9 06/01/24, 15:59
Please note that I don't intent my comments as a blocker, but as suggestions to potentially improve this change, and (as with all review comments) as a chance to learn from each other. -
Benni Mack voted on patch set 9 CR +1 V +1 06/03/24, 20:46
-
Benjamin Franzke commented on patch set 9 CR +2 V +2 06/04/24, 07:26
WidgetGroupRegistryTest.php:88Replyno, then we'd need to do that for every singleton.ContentObjectRendererTest.php:147Replyout of scope. -
Christian Kuhn voted on patch set 9 CR +1 06/04/24, 07:44
-
Benjamin Franzke commented on patch set 9 06/04/24, 07:57
ContentObjectRendererTest.php:147Replyto be fair: I think `new` would have been fine here as well, probably even better, yes. My comment was old (a draft) and I didn't fit here and I missed to recheck it before supplying the +2 vote. Anyway, I think we can keep using `createMock()` for now. -
Benjamin Franzke uploaded patch set 10
CR +1V +106/04/24, 08:20 -
Benjamin Franzke commented on patch set 10 06/04/24, 08:20
ContentObjectRendererTest.php:147ReplyChanged to `new Context()`, I agree that's the better choice in this case as a mock is not needed/helpful. -
Oliver Klee voted on patch set 10 CR +1 V +1 06/04/24, 08:22
-
Benjamin Franzke voted on patch set 10 CR +2 V +2 06/04/24, 08:25
-
Benjamin Franzke merged patch set 11 06/04/24, 08:26
-
core-ci voted on patch set 10 V +1 06/04/24, 08:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58666
WidgetGroupRegistryTest.php:88