Review main Merged

94912[TASK] Use stubs for test doubles without expectations

Wouter Wolters CR +2 V +2 Nightmare +2404 −2439 updated 07/24/26, 21:34

Commit message

Replace mocks that only configure return values with test stubs.
Keep mocks where invocation expectations are asserted.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 307

Show 287 more files

Review log 1723

  1. Wouter Wolters uploaded patch set 1 07/23/26, 18:33

  2. core-ci voted on patch set 1 V +1 07/23/26, 18:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105265

  3. Wouter Wolters uploaded patch set 2 V +1 07/23/26, 18:43

  4. Wouter Wolters marked it ready for review 07/23/26, 18:44

  5. core-ci voted on patch set 2 V +1 07/23/26, 18:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105266

  6. Oliver Klee voted on patch set 2 V +1 07/23/26, 20:07

  7. Simon Schaufelberger voted on patch set 2 CR +1 V +1 07/23/26, 21:19

  8. Stefan Bürk commented on patch set 2 CR -1 07/23/26, 23:18

    BookmarkVoterTest.php:39

    This could be removed now, right ? L41 creates a stub of the router and passes it to `BookmarkVoter` constructor instead if this local method variable, and is not used otherwise in this test (passed, set, ...)

    ResourceConsistencyServiceTest.php:111

    ```suggestion private function createStubbedStorage(int $uid): ResourceStorage&Stub ``` Method does not create a mock anymore, but a stub. Let's align the method name (also the caller within this test case !!!!)

    BeforePersistingReportEventTest.php:190

    ```suggestion private function createFeaturesStub(): Features&Stub ``` Not a mock object anymore. Do we not need the stub union type here like in one of the previous changes ?

    BeforePersistingReportEventTest.php:192

    ```suggestion $featuresStub = self::createStub(Features::class); ```

    BeforePersistingReportEventTest.php:193

    ```suggestion $featuresStub->method('isFeatureEnabled')->willReturn(true); ```

    BeforePersistingReportEventTest.php:194

    ```suggestion return $featuresStub; ```

    BackendUserAuthenticationTest.php:68

    not a mock anymore - I'll stop mentioning that, but not alligning these kind of things is possible missleading; but I get the point that that would explode the change which is already quite heavy :( - not sure how to proceede here and all the similar cases (also with helper methods having mock in it but changed to create a stub)

    RegistryTest.php:31

    Should be imported (`use` ) like the removed one for `MockObject`

    QueryResultTest.php:33

    Simplyfy FQCD (`use ...`) ...

    ExtensionManagementServiceTest.php:42

    `use ....` import

    UpgradeControllerTest.php:64

    Why not making this a stub here ?

    UpgradeControllerTest.php:103

    Why not making this a stub here ?
  9. Benni Mack uploaded patch set 3 CR +1 V +1 07/24/26, 15:24

  10. Benni Mack uploaded patch set 4 07/24/26, 15:32

  11. core-ci voted on patch set 3 V -1 07/24/26, 15:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105340

  12. core-ci voted on patch set 4 V -1 07/24/26, 15:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105341

  13. Benni Mack uploaded patch set 5 V -1 07/24/26, 15:59

  14. core-ci voted on patch set 5 V +1 07/24/26, 16:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105345

  15. Oliver Klee voted on patch set 5 V +1 07/24/26, 16:07

  16. Stefan Bürk commented on patch set 5 CR +1 V +1 07/24/26, 16:15

    BookmarkVoterTest.php:39 Reply

    Done

    ResourceConsistencyServiceTest.php:111 Reply

    Done

    BeforePersistingReportEventTest.php:190 Reply

    Done

    BeforePersistingReportEventTest.php:192 Reply

    Done

    BeforePersistingReportEventTest.php:193 Reply

    Done

    BeforePersistingReportEventTest.php:194 Reply

    Done

    BackendUserAuthenticationTest.php:68 Reply

    Done
  17. Wouter Wolters uploaded patch set 6 CR +1 V +1 07/24/26, 19:22

  18. core-ci voted on patch set 6 V +1 07/24/26, 19:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105351

  19. Wouter Wolters commented on patch set 6 07/24/26, 20:32

    RegistryTest.php:31 Reply

    Done

    QueryResultTest.php:33 Reply

    Done

    ExtensionManagementServiceTest.php:42 Reply

    Done

    UpgradeControllerTest.php:64 Reply

    Done

    UpgradeControllerTest.php:103 Reply

    Done
  20. Oliver Klee voted on patch set 6 V +1 07/24/26, 20:40

  21. Simon Schaufelberger voted on patch set 6 CR +1 V +1 07/24/26, 21:04

  22. Stefan Bürk voted on patch set 6 CR +2 V +2 07/24/26, 21:34

  23. Stefan Bürk merged patch set 7 07/24/26, 21:34