Review main Merged

74651[BUGFIX] Resolve a stray strpos call

crell CR +2 V +2 Normal +57 −6 updated 05/28/22, 23:09

Commit message

This conversion got past the big conversion patch
before, probably due to the negation.

Review

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

Issues 1

Files 3

Review log 3847

Show 1622 earlier messages
  1. crell uploaded patch set 1 05/16/22, 15:51

  2. core-ci voted on patch set 1 V -1 05/16/22, 15:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27255

  3. Oliver Klee commented on patch set 1 05/16/22, 16:19

    As this change resolves a PHPStan warning, you'll need to update the PHPStan baseline file.
  4. crell uploaded patch set 2 05/16/22, 17:11

  5. core-ci voted on patch set 2 V +1 05/16/22, 17:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27258

  6. Oliver Klee voted on patch set 2 CR +1 05/16/22, 17:22

  7. Oliver Klee commented on patch set 2 CR 0 05/16/22, 17:25

    TargetPageIdViewHelper.php:48

    I think we're actually fixing a bug here as ! has a higher precedence than ===. So I propose making this a bugfix (with a correspondingly changed commit message), add a regression test and target this for "main, 11.5". What do you think?
  8. Oliver Klee commented on patch set 2 05/16/22, 17:25

  9. crell commented on patch set 2 05/16/22, 18:47

    TargetPageIdViewHelper.php:48 Reply

    I think you're right, since the old code never passed to begin with. It probably still worked with the code below by accident. Will adjust.
  10. crell updated the commit message in patch set 3 05/16/22, 18:48

  11. core-ci voted on patch set 3 V +1 05/16/22, 18:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27260

  12. Stefan Bürk commented on patch set 3 05/16/22, 23:10

    TargetPageIdViewHelper.php:48 Reply

    To verify that this fixes a bug: https://3v4l.org/RR3ue Ack with Oliver, a regression test should be added to verify/cover this.
  13. crell uploaded patch set 4 05/17/22, 15:59

  14. crell commented on patch set 4 05/17/22, 16:07

    TargetPageIdViewHelper.php:48 Reply

    Done
  15. core-ci voted on patch set 4 V +1 05/17/22, 16:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27286

  16. Oliver Klee commented on patch set 4 05/18/22, 16:31

    TargetPageIdViewHelperTest.php:11

    Thanks for creating the testcase! For new tests, please directly add an @covers annotation to the class like this: /** * @covers \TYPO3\CMS\Redirects\ViewHelpers\TargetPageIdViewHelper */ (Please note the leading backslash, which makes is easier for human to see that the class name here is not namespace-aware.) This helps code coverage not have coverage for classes from tests that do not actually test that class.

    TargetPageIdViewHelperTest.php:16

    TargetPageIdViewHelperTest.php:18

    Please let's rename this variable for more context. ;- $context -> $renderingContext I'd also like to propose using a Prophecy stub of RenderingContextInterface instead of using the real class and overwriting the constructor to get it to hopefully not have any behavior anymore.

    TargetPageIdViewHelperTest.php:24

    In tests, please always use the strictest possible check in order to catch differences in behavior. In this case, please use assertSame insteads of equals. This catches type issues and avoids casts - just live === vs. == .

    TargetPageIdViewHelperTest.php:30

    The same points from the other test apply here.
  17. Oliver Klee wrote 05/18/22, 19:30

    Removed reviewer Oliver Klee.
  18. crell uploaded patch set 5 05/18/22, 19:37

  19. crell commented on patch set 4 05/18/22, 19:37

    TargetPageIdViewHelperTest.php:11 Reply

    Done

    TargetPageIdViewHelperTest.php:16 Reply

    Done

    TargetPageIdViewHelperTest.php:18 Reply

    Done

    TargetPageIdViewHelperTest.php:24 Reply

    Done

    TargetPageIdViewHelperTest.php:30 Reply

    Done
  20. core-ci voted on patch set 5 V -1 05/18/22, 19:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27313

  21. core-ci commented on patch set 5 05/18/22, 20:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27313

  22. Stefan Bürk commented on patch set 5 05/18/22, 20:16

    phpstan-baseline.neon:3069

    Why (and howre) are these removed ? Besides not valid and phpstan comlaining about it. ``` $ Build/Scripts/runTests.sh -s generatePhpstanBaseline ``` will add them again ....

    TargetPageIdViewHelperTest.php:4

    missing file header ``` /* * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, either version 2 * of the License, or any later version. * * For the full copyright and license information, please read the * LICENSE.txt file that was distributed with this source code. * * The TYPO3 project - inspiring people to share! */ ```

    TargetPageIdViewHelperTest.php:5

    fluid viewhelper tests has been refactored from unit to functional tests, for quite some reasons. Having this as functional test and avoiding stubbing/mocking/shallowing/castrate the rendering context at all.
  1. crell commented on patch set 5 05/18/22, 20:29

    phpstan-baseline.neon:3069 Reply

    Accidentally got copied over from another patch, I think. Will fix.

    TargetPageIdViewHelperTest.php:5 Reply

    What reasons? These particular tests have no dependencies, so making them functional tests just makes them slower for no benefit, no?
  2. Stefan Bürk commented on patch set 5 05/18/22, 22:43

    TargetPageIdViewHelperTest.php:5 Reply

    ViewHelper has often quite some dependencies. And mocking a lot of stuff is not that good. In that case, the tests are quite useless. The viewhelper uses the LinkService. So this test case could not be extended to test more with this viewhelper without moccking the linkservice etc. Having it as functional tests, this testcase can be extended easly and run with real page data and different t3:// page syntax links etc to see if the correct page id may be returned. But okay - let use the unit test for this for now. (More a fan of having the tests then together instead of splitted).
  3. crell commented on patch set 5 05/19/22, 14:02

    TargetPageIdViewHelperTest.php:4 Reply

    Done
  4. crell uploaded patch set 6 05/19/22, 14:02

  5. core-ci voted on patch set 6 V +1 05/19/22, 14:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27323

  6. Stefan Bürk voted on patch set 6 V +1 CR +1 05/19/22, 15:09

  7. Simon Schaufelberger voted on patch set 6 CR +1 05/20/22, 22:46

  8. Christian Kuhn commented on patch set 6 CR -1 05/25/22, 08:03

    TargetPageIdViewHelperTest.php:18

    wrong namespace
  9. Oliver Klee commented on patch set 6 05/25/22, 11:10

    TargetPageIdViewHelperTest.php:43

    The @covers annotation usually should go into the comment for the test class, not into the comments of the test methods.
  10. Christian Kuhn commented on patch set 6 05/25/22, 12:20

    TargetPageIdViewHelperTest.php:43 Reply

    yeah. we tend to not have @covers at all: we're not measuring coverage anyways.
  11. Stefan Bürk voted on patch set 6 V 0 CR 0 05/25/22, 12:24

  12. crell commented on patch set 6 05/27/22, 15:49

    TargetPageIdViewHelperTest.php:18 Reply

    Done

    TargetPageIdViewHelperTest.php:43 Reply

    Oliver Klee recommended it specifically to avoid PHPUnit over-reading what the test hits. I don't much care either way. I've moved it to the class for now.
  13. crell uploaded patch set 7 05/27/22, 15:49

  14. core-ci voted on patch set 7 V +1 05/27/22, 15:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27501

  15. Stefan Bürk commented on patch set 7 CR -1 05/28/22, 21:42

    TargetPageIdViewHelperTest.php:18

    Still wrong namespace, *must* be: ``` TYPO3\CMS\Redirects\Tests\Unit\ViewHelpers; ```
  16. Simon Schaufelberger uploaded patch set 8 05/28/22, 22:48

  17. Simon Schaufelberger commented on patch set 7 05/28/22, 22:48

    TargetPageIdViewHelperTest.php:18 Reply

    Fixed the wrong namespace for you.
  18. Simon Schaufelberger voted on patch set 8 V +1 CR +1 05/28/22, 22:49

  19. Stefan Bürk voted on patch set 8 V +1 CR +1 05/28/22, 22:54

  20. core-ci voted on patch set 8 V +1 05/28/22, 22:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27534

  21. Stefan Bürk voted on patch set 8 V +2 CR +2 05/28/22, 22:57

  22. Stefan Bürk merged patch set 9 05/28/22, 22:57

  23. Stefan Bürk commented on patch set 9 05/28/22, 22:59

    Note: Next time we should have the used command added to the commit message.
  24. Simon Schaufelberger commented on patch set 9 05/28/22, 23:01

    Reply

    indeed, I also overlooked that. sorry.
  25. Simon Schaufelberger commented on patch set 9 05/28/22, 23:09

    Run comand: Build/Scripts/runTests.sh -s phpstanGenerateBaseline