Review main Merged

74371[TASK] Add unit tests for mailto_makelinks

Simon Schaufelberger CR +2 V +2 Normal +92 −6 updated 05/04/22, 11:34

Commit message

Increase code coverage with some more tests.

Review

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

Issues 2

Files 1

Review log 2534

Show 69 earlier messages
  1. Simon Schaufelberger uploaded patch set 1 04/21/22, 21:23

  2. Simon Schaufelberger updated the commit message in patch set 2 04/21/22, 21:24

  3. Oliver Klee commented on patch set 2 04/21/22, 21:27

    ContentObjectRendererTest.php:2333

    I propose naming the specific correct behavior and dropping the word “correct”: mailtoMakelinksReturnsMailToLink (and then move the cases where no Mail to link is returned to a separate test) For more tips on naming tests, I recommend this slide: https://speakerdeck.com/oliverklee/test-driven-development-with-phpunit-1?slide=49
  4. core-ci voted on patch set 1 V +1 04/21/22, 21:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26285

  5. Simon Schaufelberger uploaded patch set 3 04/21/22, 21:36

  6. Simon Schaufelberger commented on patch set 2 04/21/22, 21:37

    ContentObjectRendererTest.php:2333 Reply

    better now?
  7. core-ci voted on patch set 2 V +1 04/21/22, 21:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26286

  8. Simon Schaufelberger uploaded patch set 4 04/21/22, 21:37

  9. core-ci voted on patch set 3 V +1 04/21/22, 21:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26287

  1. core-ci voted on patch set 4 V -1 04/21/22, 21:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26288

  2. core-ci voted on patch set 4 V +1 04/22/22, 04:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26288

  3. Oli Bartsch commented on patch set 4 04/22/22, 08:41

    ContentObjectRendererTest.php:2332

    I think we don't need a DataProvider for only one test case.
  4. Oliver Klee commented on patch set 4 V +1 04/22/22, 09:47

    Yes, definetely better! (And I agree that the test for the error case does not need a data provider.)
  5. Simon Schaufelberger commented on patch set 4 04/22/22, 09:59

    Reply

    I left it there for some other test cases that I didn't think about yet.
  6. Simon Schaufelberger uploaded patch set 5 04/22/22, 10:20

  7. Oliver Klee commented on patch set 4 V +1 04/22/22, 10:20

    Reply

    Are you planning to add those other test cases really soon? If not, I'd prefer to not have the data provider for now (so that the code is minimal, which reduces the cognitive load for reading and understanding the tests).
  8. Simon Schaufelberger commented on patch set 4 04/22/22, 10:21

    ContentObjectRendererTest.php:2332 Reply

    Done

    ContentObjectRendererTest.php:2333 Reply

    Done
  9. Oliver Klee voted on patch set 5 V +1 CR +1 04/22/22, 10:21

  10. Simon Schaufelberger commented on patch set 5 04/22/22, 10:22

    Reply

    no, but maybe you had an idea what else could be tested? :D
  11. Simon Schaufelberger commented on patch set 5 04/22/22, 10:23

    i made sure I cover all lines in the actual code, so now we have 100% coverage for this method, yeah!
  12. Oliver Klee commented on patch set 5 04/22/22, 10:25

    Reply

    No, not at the moment.

    Reply

    Awesome! Congratulations!
  13. Simon Schaufelberger commented on patch set 5 04/22/22, 10:26

    I just noticed that TYPO3 doesn't support "plain" email addresses and make a link out of it, it needs the "mailto:" protocol for it to work but who in the world would write that in a user generated input field?
  14. core-ci voted on patch set 5 V -1 04/22/22, 10:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26295

  15. core-ci voted on patch set 5 V +1 04/22/22, 10:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26295

  16. Andreas Kienast commented on patch set 5 CR +1 04/22/22, 13:55

    Looks fine, but I'm not sure if there could be more test cases.
  17. Stefan Bürk commented on patch set 5 CR -1 04/22/22, 22:07

    This patch should be rebased. I think this patch needs adoption of LinkFactory phropesize. See: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74376
  18. Simon Schaufelberger uploaded patch set 6 04/22/22, 22:38

  19. core-ci voted on patch set 6 V +1 04/22/22, 22:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26329

  20. Stefan Bürk uploaded patch set 7 04/23/22, 11:04

  21. Stefan Bürk commented on patch set 7 V +1 CR +1 04/23/22, 11:13

    Reply

    Not really sure either, but cannot think currently of some. Bette get these in first, as there has been no tests for it yet. If we came up with more tests, they can be added. Fine with you ?

    Reply

    Yes and no. Proper protocol has to be defined, so the link handler can decide if they are responsible for or not. But normally a user should not have to enter it manually. If you have a link field in the backend with the link browser, selecting EMAIL there you can enter/change the email in "plain" input mode. If you are doing this from the "frontend" or "custom code" you have to add prefix it before saving to a link url field. The unit tests are testing sub-handlings directly - so there the "mailto:" is expected. If called in custom code, you have to take care it is prefixed.
  22. core-ci voted on patch set 7 V +1 04/23/22, 11:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26339

  23. Oliver Klee voted on patch set 7 V +1 CR +1 05/03/22, 10:39

  24. Stefan Bürk voted on patch set 7 V +2 CR +2 05/04/22, 11:34

  25. Stefan Bürk merged patch set 8 05/04/22, 11:34