Review main Merged Breaking

74797[!!!][FEATURE] Add PSR-14 events for the BackendController

crell CR +2 V +2 Hard +242 −34 updated 07/07/22, 22:30

Commit message

This introduces two new events to interact with the backend
controller page generation process. They mirror and replace
the renderPreProcess and renderPostProcess hooks, which are removed.

The vestigial constructorPostProcess hook is also removed entirely.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Stefan Bürk +1
  • Verified V +2 Done
    • Benni Mack +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 7

Review log 4461

Show 2736 earlier messages
  1. crell uploaded patch set 1 05/31/22, 22:20

  2. core-ci voted on patch set 1 V +1 05/31/22, 22:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27610

  3. Benni Mack commented on patch set 1 05/31/22, 22:54

    BackendController.php:187

    1. should also be mentioned in the Breaking RST and be added to the ExtensionScanner 2. Do we need $this->css then?
  4. Oliver Klee commented on patch set 1 06/01/22, 09:39

    Please let's cover this with tests. (Yes, I know the old hooks were not covered by tests.)
  5. crell commented on patch set 1 06/01/22, 13:56

    Reply

    What sort of tests would be appropriate here? It would be straightforward (I think) to add a unit test that verifies that the events trigger, but I'm not certain that is all that valuable.

    BackendController.php:187 Reply

    It looks like $css is only used one other time, to write its value into an inline block. That's probably removable now as well, yes.
  6. Oliver Klee commented on patch set 1 06/01/22, 13:59

    Reply

    Yes, exactly that. And for AfterBackendPageRenderEvent, tests that check that the getter + setter work as advertised, and that the content provided to the constructor actually is set. For BeforeBackendPageRenderEvent, a test that the class can be instantiated (to catch typos in class names, namespaced etc.) would be good.
  7. crell uploaded patch set 2 06/01/22, 19:01

  8. crell commented on patch set 2 06/01/22, 19:09

    The just-added test is going to fail. I am asking for help with it. One of the deeper dependencies, ShortcutRepository, is failing because the user is invalid. I'm unsure how else to set it, though; the current BE_USER line I copied from another functional test, where it seems to have worked. Please advise. I originally tried to make a pure unit test, but the number of dependencies that would need to be mocked that still get actually used is huge in this case, so I decided it wasn't worth it. Hence just trying to swap out the event dispatcher only.
  9. core-ci voted on patch set 2 V -1 06/01/22, 19:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27636

  10. Oliver Hader commented on patch set 3 06/02/22, 07:08

    Published edit on patch set 2.
  11. Oliver Hader commented on patch set 3 06/02/22, 07:09

    Made both events `final`
  12. core-ci voted on patch set 3 V -1 06/02/22, 07:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27648

  13. crell uploaded patch set 4 06/02/22, 17:33

  14. crell commented on patch set 4 06/02/22, 17:34

    This take on the test should work. Thanks to Mathias Brodala and Oliver Hader for their assistance.
  15. core-ci voted on patch set 4 V +1 06/02/22, 17:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27659

  16. Oliver Hader commented on patch set 4 CR -1 06/03/22, 07:46

    On it
  17. Oliver Hader uploaded patch set 5 06/03/22, 07:48

  18. core-ci voted on patch set 5 V +1 06/03/22, 07:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27669

  19. Oliver Klee wrote 06/07/22, 17:43

    Removed cc Oliver Klee.
  20. crell commented on patch set 5 CR +1 06/07/22, 19:46

    (Since the last patch was from Oliver instead of me.)
  21. crell uploaded patch set 6 06/07/22, 19:50

  22. core-ci voted on patch set 6 V +1 06/07/22, 19:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27777

  23. Benni Mack commented on patch set 6 CR +1 06/08/22, 16:16

    BackendController.php:150

    hmm, thinking about this hook... how about we inject the view as well, and render the view after the event? This seems much more flexible than the existing hook?
  24. Benni Mack voted on patch set 6 CR 0 06/08/22, 16:16

  25. crell rebased onto patch set 7 06/09/22, 16:07

  26. crell commented on patch set 6 06/09/22, 16:07

    BackendController.php:150 Reply

    Done
  27. core-ci voted on patch set 7 V +1 06/09/22, 16:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27897

  28. crell uploaded patch set 8 06/09/22, 18:08

  29. core-ci voted on patch set 8 V +1 06/09/22, 18:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27898

  30. crell uploaded patch set 9 06/22/22, 14:08

  31. core-ci voted on patch set 9 V +1 06/22/22, 14:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28337

  32. Simon Schaufelberger commented on patch set 9 06/22/22, 16:08

    BackendController.php:82

    I'm just looking at the git history where this originally comes from but I don't see a clear intention when this hook got introduced. Do you think it is really useful or could it be dropped because there are no parameters and no return value.
  33. crell commented on patch set 9 06/22/22, 17:44

    BackendController.php:82 Reply

    About all it could do is mess with globals, which AFAIK is something we're trying to do less of. I'd be perfectly happy to kill it if the committers are on board.
  34. Simon Schaufelberger commented on patch set 9 06/22/22, 20:44

    BackendController.php:82 Reply

    the second event makes sense if you want to change the layout but the before event can be dropped in my opinion.
  35. crell uploaded patch set 10 06/23/22, 17:40

  36. crell commented on patch set 9 06/23/22, 17:40

    BackendController.php:82 Reply

    Here's a version with just the one hook. Committers, take your pick.
  1. core-ci voted on patch set 10 V -1 06/23/22, 17:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28359

  2. Simon Schaufelberger commented on patch set 10 06/23/22, 19:23

    Just this thing, the rest looks good to me

    BackendControllerTest.php:67

    can be replaced with "$subject = $this->get(BackendController::class);"
  3. core-ci commented on patch set 10 06/23/22, 21:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28359

  4. crell uploaded patch set 11 06/23/22, 21:50

  5. core-ci voted on patch set 11 V +1 06/23/22, 21:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28374

  6. Simon Schaufelberger commented on patch set 11 V +1 CR +1 06/24/22, 00:07

    BackendControllerTest.php:67 Reply

    Done
  7. Stefan Bürk commented on patch set 11 06/24/22, 16:58

    MockEventDispatcher.php:18

    This is a "Test Fixture Implementation". So please move this into a "Fixture/" subfolder. ``` typo3/sysect/core/Tests/Fixtures/EventDispatcher/MockEventDispatcher.php ```
  8. Stefan Bürk commented on patch set 11 06/24/22, 17:00

    MockEventDispatcher.php:18 Reply

    My bad - should be: ``` typo3/sysext/core/Tests/Unit/Fixtures/EventDispatcher/MockEventDispatcher.php ```
  9. crell uploaded patch set 12 06/27/22, 17:14

  10. core-ci voted on patch set 12 V +1 06/27/22, 17:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28442

  11. crell commented on patch set 12 06/27/22, 18:52

    MockEventDispatcher.php:18 Reply

    Done
  12. Simon Schaufelberger voted on patch set 12 V +1 CR +1 06/27/22, 21:30

  13. Oliver Hader commented on patch set 12 06/28/22, 08:44

    MockEventDispatcher.php:18 Reply

    Does not look like `MockEventDispatcher` is used at all?!
  14. crell commented on patch set 12 06/29/22, 14:11

    MockEventDispatcher.php:18 Reply

    ... Huh. Yeah, OK, it's left over from the earlier versions of the patch that used that rather than just tossing fake listeners into it. I can pull it back out for now, but there's enough other places where I think it would be useful to have that its worth having it available. I'm not sure if it's worth pulling it back out here to just add it back in later.
  15. crell uploaded patch set 13 07/06/22, 20:42

  16. core-ci voted on patch set 13 V +1 07/06/22, 20:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28693

  17. Benni Mack voted on patch set 13 V +1 CR +1 07/06/22, 20:58

  18. Stefan Bürk uploaded patch set 14 07/07/22, 20:55

  19. core-ci voted on patch set 14 V +1 07/07/22, 21:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28730

  20. Stefan Bürk commented on patch set 15 07/07/22, 21:08

    Published edit on patch set 14.
  21. Stefan Bürk voted on patch set 15 V +1 CR +1 07/07/22, 21:08

  22. core-ci voted on patch set 15 V -1 07/07/22, 21:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28731

  23. core-ci voted on patch set 15 V +1 07/07/22, 21:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28731

  24. Benni Mack voted on patch set 15 V +2 CR +2 07/07/22, 22:30

  25. Benni Mack merged patch set 16 07/07/22, 22:30