Review main Merged

74825[FEATURE] Add PSR-14 events for Mailer

Oli Bartsch CR +2 V +2 Hard +435 −1 updated 06/13/22, 19:10

Commit message

TYPO3's Mailer implementation does now dispatch
two new PSR-14 events.

The `BeforeMailerSentMessageEvent` can be
used to manipulate the message and the envelope
before being sent.

The `AfterMailerSentMessageEvent` can be used
to add further processing after the message has
been sent.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • André Buchmann +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 7

Review log 2226

Show 1 earlier messages
  1. Oli Bartsch uploaded patch set 1 06/07/22, 20:48

  1. Benni Mack commented on patch set 1 06/07/22, 20:49

    Would be great to have tests for this
  2. Oli Bartsch commented on patch set 1 06/07/22, 20:57

    Reply

    Which kind of test do you have in mind?
  3. core-ci voted on patch set 1 V +1 06/07/22, 21:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27779

  4. Joey Bouten voted on patch set 1 CR +1 06/08/22, 12:07

  5. Oliver Klee commented on patch set 1 06/08/22, 12:25

    Reply

    Suggestions for tests: - for the two event classes, tests that the setters/getters pass the data around as intended - for the mailer, tests that check that the events are fired and provided with the intended data/objects
  6. Oli Bartsch commented on patch set 1 06/09/22, 08:56

    Reply

    Thanks for the suggestions. Could you please describe the benefit in testing type hinted setters and getters for their passed data? Those methods do not contain any additional functionality which could be tested, so only the types could be tested, which as said are type hinted.
  7. Oliver Klee commented on patch set 1 06/09/22, 09:18

    Reply

    Type annotations are also code, and that code could be wrong. (In other words, the tests serve as a kind of "double bookkeeping", and if we rely on the type annotations alone, we reduce this to single bookkeeping.) In addition, the getter and setter methods have code that could be incorrect. For example, the type annotations would have no problem with an empty setter, or with a setter with a typo in the property name, or with a getter always returning a new instance. In addition, if something breaks, it is helpful to know whether the getters and setters are reliable so we can rule them out as the cause of the problem.
  8. Benni Mack commented on patch set 1 06/09/22, 15:39

    Reply

    So, should this be Unit Tests or Functional Tests?
  9. Oliver Klee commented on patch set 1 06/09/22, 16:01

    Reply

    The tests for the event classes themselves should be unit tests. The tests for the mailer should preferably be unit tests (if we can get this to work), and otherwise functional tests.
  10. Oli Bartsch uploaded patch set 2 06/10/22, 15:16

  11. Oli Bartsch commented on patch set 2 06/10/22, 15:17

    Reply

    Done
  12. core-ci voted on patch set 2 V -1 06/10/22, 15:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27931

  13. Oli Bartsch uploaded patch set 3 06/10/22, 15:34

  14. core-ci voted on patch set 3 V +1 06/10/22, 15:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27933

  15. Simon Schaufelberger commented on patch set 3 06/10/22, 17:31

  16. André Buchmann commented on patch set 3 CR -1 06/11/22, 19:02

    Feature-93689-PSR-14EventsOnSendingMessagesWithMailer.rst:88

    I think there should be no comma between "messages" and "before". Second sentence contains duplicate "has". Suggestion: With the new PSR-14 events, it's now possible to manipulate messages before they are sent by the mailer. Additionally, after the mailer has sent messages, further processing can be performed.
  17. Oli Bartsch uploaded patch set 4 06/13/22, 06:44

  18. Oli Bartsch commented on patch set 4 06/13/22, 06:45

    Reply

    No, does not conflict.

    Feature-93689-PSR-14EventsOnSendingMessagesWithMailer.rst:88 Reply

    Done
  19. core-ci voted on patch set 4 V +1 06/13/22, 06:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28000

  20. André Buchmann voted on patch set 4 CR +1 06/13/22, 07:19

  21. Oliver Klee voted on patch set 4 CR +1 06/13/22, 11:35

  22. Benni Mack voted on patch set 4 V +1 CR +1 06/13/22, 11:46

  23. Stefan Bürk voted on patch set 4 V +1 CR +1 06/13/22, 15:21

  24. Oli Bartsch voted on patch set 4 V +2 CR +2 06/13/22, 19:10

  25. Oli Bartsch merged patch set 5 06/13/22, 19:10