Review main Merged

55855[TASK] Unit tests: Do not rely on CacheManager instance

Christian Kuhn CR +2 V +2 Expert +577 −581 updated 02/21/18, 20:23

Commit message

The typo3/testing-framework bootstrap up until now
initialized the CacheManager singleton and put it
into GeneralUtility instance stack.
To better isolate the tests and as a next step in
side effect free uni testing, the test bootstrap
now cleans this instance after use:

composer update typo/testing-framework

About 300 tests fail with this and are fixed with
the patch by improving their mocking.

Review

  • Code review CR +2
    • Andreas Kienast +2
    • Mathias Schreiber +1
  • Verified V +2
    • Andreas Kienast +2
    • Mathias Schreiber +1
    • TYPO3com +1 CI

Issues 1

Files 35

Show 15 more files

Review log 1013

  1. Christian Kuhn uploaded patch set 1 02/21/18, 17:44

  2. Christian Kuhn commented on patch set 1 02/21/18, 17:52

    note: in a next step we can clean up the singleton backups within tests, but that will happen with an own patch and needs further preparation.

    FileWriter.php:171

    this avoids a notice.

    IntegrityTest.php:39

    this integrity test is obsolete now with the bootstrap cleaning up after itself.

    LocalizationUtilityTest.php:490

    that should have been a functional test if any, otherwise it instantiates much more than just the test class under test.

    UpdateFromTerControllerTest.php:23

    this test class did not add value: the tests mocked $planet, just to verify a single call is done. Unit testing on controller 'glue code' does not add value and could only be done in a useful way as functional or acceptance test to test the whole thing including dependencies.

    FrontendUserAuthenticationTest.php:257

    this is a drive-by patch that should stabilize this flacky test, depending on test order.

    CoreUpdateServiceTest.php:79

    this test does not give much benefit and is very hard to mock properly.

    Pbkdf2SaltTest.php:47

    this test was useless - and there is no xclassing in unit tests anyway.
  3. TYPO3com voted on patch set 1 V -1 02/21/18, 17:53 Completed build in 08m 29s on Wed, 21 Feb, 06:53 PM Test Summary: 6 of 31039 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-19988

  4. Christian Kuhn commented on patch set 1 02/21/18, 17:54

    ah snap, forgot about the deprecated unit tests.
  5. Christian Kuhn uploaded patch set 2 02/21/18, 18:04

  6. TYPO3com voted on patch set 2 V +1 02/21/18, 18:12 Completed build in 08m 06s on Wed, 21 Feb, 07:12 PM Test Summary: 30887 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-19991

  7. Christian Kuhn voted on patch set 2 CR -1 02/21/18, 18:46

  8. Christian Kuhn uploaded patch set 3 02/21/18, 18:51

  9. TYPO3com voted on patch set 3 V +1 02/21/18, 19:00 Completed build in 08m 18s on Wed, 21 Feb, 08:00 PM Test Summary: 30887 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-19992

  10. Mathias Schreiber voted on patch set 3 V +1 CR +1 02/21/18, 19:51

  11. Andreas Kienast voted on patch set 3 V +1 02/21/18, 20:11

  12. Andreas Kienast voted on patch set 3 V +2 CR +2 02/21/18, 20:23

  13. Andreas Kienast merged patch set 4 02/21/18, 20:23