Review main Merged

95096[TASK] Stop assuming the classic layout in functional tests

Benni Mack CR +2 V +2 Hard +580 −366 updated 08/09/26, 16:49

Commit message

Functional tests currently describe file locations the way a classic
mode installation lays them out: extensions below the document root in
typo3/sysext and typo3conf/ext, configuration in typo3conf/system,
labels in typo3conf/l10n, and public extension resources reachable
under the same paths. None of that holds in a composer installation,
where extensions live in vendor beside a public/ document root and
public resources are published into _assets.

Express those locations through the API that knows the difference:

* Environment::getPublicPath() where a path came from rendered output
  and is therefore relative to the document root
* Environment::getConfigPath() and Environment::getLabelsPath() for
  the settings file and the label overrides
* ExtensionManagementUtility::extPath() for an extension's location
  on disk
* PathUtility::getSystemResourceUri() for the web path of a public
  extension resource

Expectations that name such a path have to derive it in the test
method rather than in a data provider, because data providers run
before the test instance is bootstrapped.

Resolving the paths correctly uncovers a few things that were wrong
independently of the installation mode:

* GeneralUtilityTest resolved its {{project-path}} placeholder with
  Environment::getPublicPath(), while isAllowedAbsPath() gates on the
  project path. The two coincide in classic mode, so the sibling
  directory cases only appeared to be rejected.
* ZipServiceTest created its target directory with GeneralUtility::
  mkdir(), which cannot create the parent directory it needs.
* TcaSelectItemsTest built a scratch directory below the document
  root, which is a symlink into the source tree, so the test wrote
  temporary files into typo3/sysext/backend/Resources/Public/.
* ContentObjectRendererTest expected a cache busting query string on
  a path that never carries one.

No behaviour of the tested code changes, and the suite keeps running
in classic mode exactly as before.

Review

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

Issues 1

Files 62

Show 42 more files

Review log 1922

  1. Benni Mack uploaded patch set 1 08/04/26, 07:57

  2. core-ci voted on patch set 1 V +1 08/04/26, 08:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105928

  3. Benni Mack marked it ready for review 08/04/26, 08:08

  4. Oliver Klee voted on patch set 1 V +1 08/04/26, 08:20

  5. Georg Ringer voted on patch set 1 CR +1 V +1 08/04/26, 09:02

  6. Andreas Kienast commented on patch set 1 08/04/26, 10:11

    BitmapIconProviderTest.php:77

    IMO we don't need to have this in a separate method.

    AssetRendererTest.php:245

    `(string)` cast is not needed as `$markup` is already a string.

    ImportMapTest.php:106

    Would it make sense to store the result of `this->assetPath(...)` in a variable instead of resolving it repetitively?

    IconViewHelperTest.php:99

    Do we really need the method wrapper?

    SvgImageViewHelperTest.php:534

    `(string)` cast is not needed

    ResourceViewHelperTest.php:186

    `(string)` cast is not needed

    UriPrefixRenderingTest.php:73

    Low-grade nit-pick: this condition is faster than `str_starts_with(...)`
  7. Simon Schaufelberger voted on patch set 1 CR +1 V +1 08/04/26, 10:11

  8. Wouter Wolters voted on patch set 1 CR +1 V +1 08/04/26, 18:53

  9. Stefan Bürk voted on patch set 1 CR +1 V +1 08/06/26, 14:21

  10. Benni Mack uploaded patch set 2 CR +1 V +1 08/06/26, 16:22

  11. core-ci voted on patch set 2 V +1 08/06/26, 16:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106005

  12. Wouter Wolters voted on patch set 2 CR +1 V +1 08/06/26, 16:40

  13. Georg Ringer voted on patch set 2 CR +1 V +1 08/06/26, 18:23

  14. Oliver Klee voted on patch set 2 V +1 08/06/26, 21:38

  15. Benni Mack uploaded patch set 3 CR +1 V +1 08/08/26, 14:30

  16. Benni Mack marked it ready for review 08/08/26, 14:30

  17. core-ci voted on patch set 3 V +1 08/08/26, 14:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106184

  18. Benni Mack commented on patch set 3 08/08/26, 14:55

    BitmapIconProviderTest.php:77 Reply

    Done

    AssetRendererTest.php:245 Reply

    Done

    ImportMapTest.php:106 Reply

    Done

    IconViewHelperTest.php:99 Reply

    Done

    SvgImageViewHelperTest.php:534 Reply

    Done

    ResourceViewHelperTest.php:186 Reply

    Done

    UriPrefixRenderingTest.php:73 Reply

    Done
  19. Simon Schaufelberger voted on patch set 3 CR +1 V +1 08/09/26, 10:44

  20. Oliver Klee voted on patch set 3 V +1 08/09/26, 12:45

  21. Stefan Bürk voted on patch set 3 CR +2 V +2 08/09/26, 16:49

  22. Stefan Bürk merged patch set 4 08/09/26, 16:49