TYPO3-Documentation / TYPO3CMS-Reference-CoreApi

"TYPO3 Explained": Main TYPO3 Core Document: Main classes, Security, TypoScript syntax, Extension API and much more
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/
21 stars 370 forks source link

Describe relation to Resources/Public in Extension Testing #1786

Open t3easy opened 2 years ago

t3easy commented 2 years ago

Since TYPO3 11.4 it is necessary to set

  1. The folder Resources/Public must be present in the extension e.g. by adding an extension icon Resources/Public/Icons/Extension.svg

If this is missing, the extension isn't symlinked to .Build/public/typo3conf/ext and can't be includes in functional tests with $testExtensionsToLoad. You'll get an error like TYPO3\TestingFramework\Core\Exception: Test extension path /home/runner/work/my_ext/my_ext/.Build/public/typo3conf/ext/my_ext not found.

See: https://typo3.slack.com/archives/C027S5XR1/p1648153442350779 https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/Testing/ExtensionTesting.html https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.4/Feature-94996-ConsiderAllComposerInstalledExtensionsAsActive.html

And thanks to @sbuerk!

sbuerk commented 2 years ago

That's not correct. I thought first the ignore-as-root is needed. But that was an itermediate way.

It simply boils down to following:

If something exists in Resources/Public/*, the extension is symlinked to <publicpath>/typo3conf/ext/<ext-key>

A extra.typo3/cms section is needed that the "root-package" is regonized as "extension" at all.

As I remember right, using the ignore-as-root: false has been a first solution, reworked couple of day after - and thus changed. Missing to correct the documentation.

Following from the changelog is what's needed to be described in the ExtensionTesting example(instructions):

However, when extensions are used as root package for testing (e.g., for running unit, functional or integration tests in a CI pipeline) and these extensions have files in the Resources/Public directory, a symlink in the typo3conf/ext directory is automatically created. Additionally the package path is adapted to be inside typo3conf/ext. This allows TYPO3 to properly calculate URLs for public resources of this extension.

If the root package isn’t of type typo3-cms-extension or does not have a Resources/Public directory the absolute path to the extension remains the original path to the composer root directory and no symlink is created.

This special behaviour for root packages of type typo3-cms-extension is introduced as a temporary fix to ease extension testing. It is explicitly NOT recommended to use such a setup in production.

t3easy commented 2 years ago

I needed both. If i remove ignore-as-root, delete .Build and composer update, there is no /typo3conf/ext/my_ext

mbrodala commented 2 years ago

I wonder if the testing frameworks need a general adjustment to e.g. also symlink vendor and thus have all typo3-cms-extension packages available and active automatically. Then both $coreExtensionsToLoad and $testExtensionsToLoad would be obsolete. (The latter could still be used for actual test extensions.)

sbuerk commented 2 years ago

I needed both. If i remove ignore-as-root, delete .Build and composer update, there is no /typo3conf/ext/my_ext

Have done that do (except composer install instead of update) and the symlink was there. Without the "ignore-as-root" option.

Will recheck this later.

t3easy commented 2 years ago

OK, you're right!: https://github.com/t3easy/filecategories/commit/80137e106d1efdc0122919d01dafae187c29a273

t3easy commented 2 years ago

I updated the description of the issue.

DavidBruchmann commented 1 year ago

@sbuerk @t3easy @mbrodala what's the status of this issue, is there still some documentation to adjust, or can it be closed?