Review main Merged

70593[TASK] Strictify UnitTests part 5 - EXT:core

Roman Büchler CR +2 V +2 Nightmare +2861 −3398 updated 09/11/21, 11:06

Commit message

Review

  • Code review CR +2 Done
    • Anja Leichsenring +2
    • Christian Kuhn +1
  • Verified V +2 Done
    • Anja Leichsenring +2
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 381

Show 361 more files

Review log 3458

Show 1833 earlier messages
  1. Roman Büchler uploaded patch set 1 08/14/21, 18:12

  2. core-ci voted on patch set 1 V -1 08/14/21, 18:17 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15104

  3. Roman Büchler uploaded patch set 2 08/14/21, 18:30

  4. core-ci voted on patch set 2 V -1 08/14/21, 18:34 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15106

  5. Roman Büchler uploaded patch set 3 08/15/21, 08:47

  6. Roman Büchler wrote 08/15/21, 08:51

    Topic set to unit-strict
  7. core-ci voted on patch set 3 V -1 08/15/21, 09:11 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15113

  8. Roman Büchler uploaded patch set 4 08/16/21, 04:33

  9. core-ci voted on patch set 4 V -1 08/16/21, 04:52 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15141

  10. Roman Büchler uploaded patch set 5 08/16/21, 06:07

  11. core-ci voted on patch set 5 V -1 08/16/21, 06:26 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15143

  12. Roman Büchler uploaded patch set 6 08/16/21, 07:48

  13. core-ci voted on patch set 6 V -1 08/16/21, 07:51 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15147

  14. Roman Büchler uploaded patch set 7 08/16/21, 12:17

  15. core-ci voted on patch set 7 V -1 08/16/21, 14:22 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15175

  16. Roman Büchler uploaded patch set 8 08/16/21, 14:49

  17. core-ci voted on patch set 8 V -1 08/16/21, 16:52 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15187

  18. Wouter Wolters commented on patch set 8 08/16/21, 17:17

    AbstractActionTestCase.php:108 Unresolved

    this should return void I think

    CheckboxElementItems.php:29 Unresolved

    this function does not return an array.
  19. Roman Büchler uploaded patch set 9 08/16/21, 17:27

  20. Roman Büchler uploaded patch set 10 08/16/21, 18:18

  21. core-ci voted on patch set 9 V -1 08/16/21, 19:34 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15202

  22. core-ci voted on patch set 10 V -1 08/16/21, 20:21 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15206

  23. Roman Büchler uploaded patch set 11 08/17/21, 04:35

  24. core-ci voted on patch set 11 V -1 08/17/21, 06:38 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15218

  25. Roman Büchler uploaded patch set 12 08/17/21, 08:04

  26. core-ci voted on patch set 12 V -1 08/17/21, 08:24 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15223

  27. Roman Büchler uploaded patch set 13 08/17/21, 09:05

  28. core-ci voted on patch set 13 V -1 08/17/21, 11:08 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15226

  29. Roman Büchler uploaded patch set 14 08/18/21, 04:51

  30. core-ci voted on patch set 14 V -1 08/18/21, 06:54 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15254

  31. Roman Büchler uploaded patch set 15 08/18/21, 07:52

  32. core-ci voted on patch set 15 V -1 08/18/21, 09:55 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15255

  33. Roman Büchler uploaded patch set 16 08/18/21, 10:53

  1. core-ci voted on patch set 16 V -1 08/18/21, 13:03 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15264

  2. Roman Büchler uploaded patch set 17 08/18/21, 17:10

  3. core-ci voted on patch set 17 V +1 08/18/21, 17:24 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15277

  4. Jonas Eberle commented on patch set 17 08/18/21, 21:39

    Thank you! I have reviewed until typo3/sysext/core/Tests/Unit/Localization/LocalesTest.php - only 100 more to go ;) The ?nullable thing is not strictly necessary at all (will just throw when accessed uninitialised) and could especially be overlooked in test cases where it is initialized in setUp(). Yet still good practice IMHO. It would be great if you could train your phpstan/rector/? AI to respect that. It's great that this revealed some wrong phpdocs types. It feels like archeology :)
    The used command would be nice to see.

    RecoveryCodesTest.php:116

    $codes[0] would be more explicit IMHO.

    SiteConfigurationTest.php:37

    ?SiteConfiguration

    SiteConfigurationTest.php:43

    ?string since no default value and not assigned in constructor (according to pinned post in #typo3-core-dev)

    AbstractConditionMatcherTest.php:54

    ?\ReflectionMethod

    Argon2iPasswordHashTest.php:28

    ?nullable

    BcryptPasswordHashTest.php:28

    ?nullable

    DataHandlerTest.php:326

    That is because inputValuesRangeDoubleDataProvider() provides string,string|int I suggest the phpdoc here.

    DataHandlerTest.php:349

    same here

    DataHandlerTest.php:395

    "string $value" should be possible here

    DataHandlerTest.php:724

    I suggest phpdoc here: bool, int|string|null, int|string|null, string, bool

    ConnectionTest.php:49

    ?nullable

    MockPlatform.php:147

    This could also be solved by prophesizing getName() in \TYPO3\CMS\Core\Tests\Unit\Database\Query\Expression\ExpressionBuilderTest::defaultBitwiseAnd": $databasePlatform->getName()->willReturn('someName');

    BulkInsertTest.php:33

    ?nullable

    ExpressionBuilderTest.php:41

    ?nullable

    QueryBuilderTest.php:52

    ?nullable

    DefaultTcaSchemaTest.php:34

    ?nullable

    TableBuilderTest.php:43

    ?nullable

    FailsafeContainerTest.php:37

    ?nullable

    ServiceProviderCompilationPassTest.php:39

    Can't we ": ServiceProviderRegistry" here?

    EventDispatcherTest.php:39

    ?nullable

    ListenerProviderTest.php:38

    ?nullable

    AbstractFormProtectionTest.php:28

    ?nullable

    HtmlParserTest.php:28

    ?nullable

    MessageTest.php:32

    ?nullable []

    RequestTest.php:32

    ?nullable

    ResponseTest.php:31

    ?nullable

    ServerRequestTest.php:32

    ?nullable

    StreamTest.php:32

    ?nullable

    DimensionTest.php:29

    ?nullable

    IconFactoryTest.php:204

    array

    IconFactoryTest.php:244

    array $size

    BitmapIconProviderTest.php:30

    ?nullable

    FontawesomeIconProviderTest.php:35

    ?nullable

    SvgIconProviderTest.php:30

    ?nullable

    SvgSpriteIconProviderTest.php:30

    ?nullable

    IconTest.php:38

    ?nullable

    LinkServiceTest.php:189

    actually it works 😊

    LinkServiceTest.php:205

    actually ok

    PageLinkHandlerTest.php:72

    should be array, array, string

    PageLinkHandlerTest.php:92

    should be array, array, string

    TelephoneLinkHandlerTest.php:83

    I don't understand this one. The test data is array, array, string

    TelephoneLinkHandlerTest.php:99

    array, array, string
  5. Roman Büchler commented on patch set 17 08/20/21, 10:27

    Thank you for reviewing and the feedback. I reviewed the remaining classes and added the nullable type accordingly.

    Reply

    The changes were manually applied, rector hasn't been used yet...

    RecoveryCodesTest.php:116 Reply

    Done

    SiteConfigurationTest.php:37 Reply

    Done

    SiteConfigurationTest.php:43 Reply

    Done

    AbstractConditionMatcherTest.php:54 Reply

    Done

    Argon2iPasswordHashTest.php:28 Reply

    Done

    BcryptPasswordHashTest.php:28 Reply

    Done

    DataHandlerTest.php:326 Reply

    Done

    DataHandlerTest.php:349 Reply

    Done

    DataHandlerTest.php:395 Reply

    Done

    DataHandlerTest.php:724 Reply

    Done

    ConnectionTest.php:49 Reply

    Done

    MockPlatform.php:147 Reply

    I am not familiar with prophesizing. Could you give me more information on that?

    BulkInsertTest.php:33 Reply

    Done

    ExpressionBuilderTest.php:41 Reply

    Done

    QueryBuilderTest.php:52 Reply

    Done

    DefaultTcaSchemaTest.php:34 Reply

    Done

    TableBuilderTest.php:43 Reply

    Done

    FailsafeContainerTest.php:37 Reply

    Done

    ServiceProviderCompilationPassTest.php:39 Reply

    Done

    EventDispatcherTest.php:39 Reply

    Done

    ListenerProviderTest.php:38 Reply

    Done

    AbstractFormProtectionTest.php:28 Reply

    Done

    HtmlParserTest.php:28 Reply

    Done

    MessageTest.php:32 Reply

    Done

    RequestTest.php:32 Reply

    Done

    ResponseTest.php:31 Reply

    Done

    ServerRequestTest.php:32 Reply

    Done

    StreamTest.php:32 Reply

    Done

    DimensionTest.php:29 Reply

    Done

    IconFactoryTest.php:204 Reply

    An error occures when array is declared as return type

    IconFactoryTest.php:244 Reply

    Done

    BitmapIconProviderTest.php:30 Reply

    Done

    FontawesomeIconProviderTest.php:35 Reply

    Done

    SvgIconProviderTest.php:30 Reply

    Done

    SvgSpriteIconProviderTest.php:30 Reply

    Done

    IconTest.php:38 Reply

    Done

    LinkServiceTest.php:189 Reply

    Done

    LinkServiceTest.php:205 Reply

    Done

    PageLinkHandlerTest.php:72 Reply

    Done

    PageLinkHandlerTest.php:92 Reply

    Done

    TelephoneLinkHandlerTest.php:83 Reply

    Done

    TelephoneLinkHandlerTest.php:99 Reply

    Done
  6. Roman Büchler uploaded patch set 18 08/20/21, 10:28

  7. core-ci voted on patch set 18 V +1 08/20/21, 10:48 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15324

  8. Jonas Eberle commented on patch set 18 08/20/21, 10:57

    Reply

    Done
    Yay!

    MockPlatform.php:147 Reply

    All I know is that any dummy object method will return null (https://github.com/phpspec/prophecy#dummies) unless it has a method stub. Looking at the other tests around TYPO3\CMS\Core\Tests\Unit\Database\Query\Expression\ExpressionBuilderTest::defaultBitwiseAnd it looks like it was just forgotten there.

    IconFactoryTest.php:204 Reply

    I meant `array $size` (the function is called once for every entry from differentSizesDataProvider()) - actually that data provider looks invalid, but at least it returns an array of arrays (https://phpunit.readthedocs.io/en/9.5/writing-tests-for-phpunit.html?highlight=dataprovider#data-providers)
  9. Roman Büchler commented on patch set 18 08/20/21, 12:47

    MockPlatform.php:147 Reply

    Done

    IconFactoryTest.php:204 Reply

    Done
  10. Roman Büchler uploaded patch set 19 08/20/21, 12:48

  11. core-ci voted on patch set 19 V +1 08/20/21, 13:07 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15326

  12. Anja Leichsenring voted on patch set 19 V +1 CR +1 08/23/21, 16:56

  13. Anja Leichsenring uploaded patch set 20 09/11/21, 09:44

  14. core-ci voted on patch set 20 V -1 09/11/21, 09:54 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16527

  15. Anja Leichsenring uploaded patch set 21 09/11/21, 09:55

  16. core-ci voted on patch set 21 V -1 09/11/21, 09:59 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16530

  17. Christian Kuhn uploaded patch set 22 09/11/21, 10:06

  18. core-ci voted on patch set 22 V -1 09/11/21, 10:22 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16531

  19. Anja Leichsenring uploaded patch set 23 09/11/21, 10:37

  20. core-ci voted on patch set 23 V -1 09/11/21, 10:41 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16532

  21. Christian Kuhn uploaded patch set 24 09/11/21, 10:42

  22. core-ci voted on patch set 24 V +1 09/11/21, 10:55 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16533

  23. Christian Kuhn voted on patch set 24 V +1 CR +1 09/11/21, 10:56

  24. Anja Leichsenring voted on patch set 24 V +2 CR +2 09/11/21, 11:06

  25. Anja Leichsenring merged patch set 25 09/11/21, 11:06