61518[TASK] Add tests for linkvalidator
Commit message
Review
-
Code review CR +2 Done
- Tymoteusz Motylewski +2
- Oliver Klee +1
- Jan Stockfisch +1
- Andreas Kienast +1
-
Verified V +2 Done
- Tymoteusz Motylewski +2
- Jan Stockfisch +1
- TYPO3com +1 CI
Issues 1
Files 1
Review log 3040
Show 1015 earlier messages
-
Sybille Peters uploaded patch set 1 08/20/19, 12:17
-
TYPO3com voted on patch set 1 V +1 08/20/19, 12:28 Completed build in 10m 53s on Tue, 20 Aug, 12:28 PM Test Summary: 47215 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35745
-
Sybille Peters uploaded patch set 2 08/20/19, 12:57
-
TYPO3com voted on patch set 2 V +1 08/20/19, 13:06 Completed build in 08m 55s on Tue, 20 Aug, 01:06 PM Test Summary: 47215 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35748
-
Sybille Peters uploaded patch set 3 08/20/19, 13:33
-
TYPO3com voted on patch set 3 V +1 08/20/19, 13:43 Completed build in 10m 44s on Tue, 20 Aug, 01:43 PM Test Summary: 47215 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35750
-
Oliver Klee commented on patch set 3 08/20/19, 19:23
ExternalLinktypeTest.php:45I propose dropping this comment and having a test name that reads like a sentence. Maybe this slide will help: https://speakerdeck.com/oliverklee/test-driven-development-with-phpunit-1?slide=49ExternalLinktypeTest.php:55I recommend using assertSame instead of assertEquals so the checks are as strict as possible. -
Sybille Peters uploaded patch set 4 08/21/19, 06:05
-
TYPO3com voted on patch set 4 V -1 08/21/19, 06:05 Completed build in 12s on Wed, 21 Aug, 06:05 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35752
-
Sybille Peters wrote 08/21/19, 06:05
Description set to "Fixed issues raised for test" -
Sybille Peters uploaded patch set 5 08/21/19, 06:10
-
Sybille Peters wrote 08/21/19, 06:10
Description set to "Fix CGL issue" -
Sybille Peters commented on patch set 5 08/21/19, 06:11
Thank you. That was very helpful. This is my first contribution to testing the core :)ExternalLinktypeTest.php:36ReplyDoneExternalLinktypeTest.php:45ReplyDoneExternalLinktypeTest.php:55ReplyDone -
TYPO3com voted on patch set 5 V +1 08/21/19, 06:22 Completed build in 11m 58s on Wed, 21 Aug, 06:22 AM Test Summary: 47215 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35753
-
Oliver Klee commented on patch set 5 08/21/19, 08:56
AbstractLinktype.php:86If I read the change description correctly, the change should only add tests. I'd prefer we keep it that way and move new functionality to a different changeset.AbstractLinktype.php:115$languageService is no boolean. So the check should be ($languageService !== null) instead.ExternalLinktype.php:121The second $this looks like it does not belong here.FileLinktype.php:59Why this change?ExternalLinktypeTest.php:35By convention, the instance of the tested class is named "subject". I hence recommend renaming it.ExternalLinktypeTest.php:47These should be two separate tests - one for checkLink and one for getErrorType. This will also make naming the tests easier and will make the different failure messages unnecessary.ExternalLinktypeTest.php:50I propose adding a verb to the method name: languageServiceProphecy An I recommend placing the helper methods between setUp/tearDown and the first test to make them easier findable.
-
Sybille Peters commented on patch set 5 08/21/19, 09:06
AbstractLinktype.php:86ReplyI understand. I started to change some of the API (e.g. LanguageService) as necessary for the test, but I can move everything that is not absolutely necessary for the test to a different changeset. -
Sybille Peters uploaded patch set 6 08/21/19, 09:24
-
Sybille Peters wrote 08/21/19, 09:25
Description set to "Remove changes not required for test." -
Sybille Peters uploaded patch set 7 08/21/19, 09:34
-
Sybille Peters wrote 08/21/19, 09:34
Description set to "Fix issues raised in review" -
Sybille Peters commented on patch set 7 08/21/19, 09:34
AbstractLinktype.php:86ReplyDoneAbstractLinktype.php:115ReplyDoneExternalLinktype.php:121ReplyDoneFileLinktype.php:59ReplyDoneExternalLinktypeTest.php:35ReplyDoneExternalLinktypeTest.php:47ReplyDoneExternalLinktypeTest.php:50ReplyDone -
TYPO3com voted on patch set 6 V +1 08/21/19, 09:36 Completed build in 11m 52s on Wed, 21 Aug, 09:36 AM Test Summary: 47215 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35754
-
Sybille Peters uploaded patch set 8 08/21/19, 09:38
-
TYPO3com voted on patch set 7 V -1 08/21/19, 09:45 Completed build in 11m 30s on Wed, 21 Aug, 09:45 AM Test Summary: 1 of 47578 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35755
-
TYPO3com voted on patch set 8 V +1 08/21/19, 09:47 Completed build in 09m 10s on Wed, 21 Aug, 09:47 AM Test Summary: 47219 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35756
-
Oliver Klee commented on patch set 8 08/22/19, 10:54
AbstractLinktype.php:36There should be spaces around the = sign. Also, if $languageService can be null, the more correct type would be the nullable one: ?LanguageServiceAbstractLinktype.php:104You can simplify the tests by setting $GLOBALS['LANG'] instead. Then you don't need to modify the classes.ExternalLinktypeTest.php:38I propose to rename this from get* to build* as this makes the behavior more explicit (it does not return an existing prophecy, but builds a new one).ExternalLinktypeTest.php:43Is the return value important? If not, you can use shouldBeCalled() instead.ExternalLinktypeTest.php:53I recommend using example.org (the official example domain for this kind of purpose) for all domains in URLs and email addresses where the actual domain is not important.ExternalLinktypeTest.php:55As we now have good, expressive test names, the messages in the asserts are not needed anymore.ExternalLinktypeTest.php:61I recommend not using "correct" in test names, but the actual expected behavior/value instead. This allows the reader to assess the behavior from reading the test name, and to compare it with the test code. In this case, I propose this: CorrectErrorType -> NotFoundErrorTypeExternalLinktypeTest.php:64By the way, does the link validator actually access these URLs? If so, these tests should be functional tests. (And if not, they're perfectly fine as unit tests.)ExternalLinktypeTest.php:66By the way, you can make the structure of the test more explicit by adding a blank line between the sections: 1. setup ($url = etc.) 2. execution (checkLink call) 3. evaluation (asserts) -
Sybille Peters uploaded patch set 9 08/22/19, 15:33
-
Sybille Peters commented on patch set 9 08/22/19, 15:33
AbstractLinktype.php:36ReplyDoneAbstractLinktype.php:104ReplyDoneExternalLinktypeTest.php:38ReplyDoneExternalLinktypeTest.php:43ReplyDoneExternalLinktypeTest.php:53Reply UnresolvedDoneExternalLinktypeTest.php:55ReplyDoneExternalLinktypeTest.php:61ReplyDoneExternalLinktypeTest.php:64Reply UnresolvedYes, the URLs get accessed. If we don't want that, we can mock / prophecy the $requestFactory. But then we are not really testing much anymore. I read the section on Unit Tests in "TYPO3 Explained" (https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/Testing/WritingUnit.html). It discourages to just test glue code, which is probably what I would be doing. I was trying to avoid the functional tests for now because I think it may be a problem with the current functionality which may not be modular enough. I was hoping to add the functional tests together with some refactoring. What I could do now is try to create functional tests in a next patchset and see if this is easily doable and my concerns were premature. If this is possible we could decide if we keep the unit tests or throw them away. In any case, I got useful advice :)ExternalLinktypeTest.php:66ReplyDone -
Sybille Peters wrote 08/22/19, 15:33
Description set to "Change with comments from review" -
TYPO3com voted on patch set 9 V +1 08/22/19, 15:43 Completed build in 10m 16s on Thu, 22 Aug, 03:43 PM Test Summary: 47219 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35772
-
Sybille Peters uploaded patch set 10 08/22/19, 17:01
-
Sybille Peters wrote 08/22/19, 17:02
Description set to "prophesize RequestFactory" -
Sybille Peters commented on patch set 10 08/22/19, 17:02
ExternalLinktypeTest.php:38ReplyDone -
TYPO3com voted on patch set 10 V +1 08/22/19, 17:12 Completed build in 10m 44s on Thu, 22 Aug, 05:12 PM Test Summary: 47219 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35774
-
Oliver Klee commented on patch set 10 CR +1 08/25/19, 16:41
Looks very good! -
Andreas Kienast voted on patch set 10 CR +1 08/26/19, 08:11
-
Jan Stockfisch voted on patch set 10 CR +1 08/26/19, 15:18
-
Jan Stockfisch voted on patch set 10 V +1 08/26/19, 15:24
-
Tymoteusz Motylewski voted on patch set 10 V +2 CR +2 08/27/19, 21:30
-
Tymoteusz Motylewski merged patch set 11 08/27/19, 21:31
ExternalLinktypeTest.php:36