Skip to content

Conversation

@sbuerk
Copy link
Member

@sbuerk sbuerk commented Apr 14, 2025

To make frontend requests within functional tests a proper
frontend page setup is required, and TYPO3 uses internally
a SiteBasedTestTrait for own tests, which is not provided
in distrubtion packages.

Extension created and maintained there own versions, and in
some cased tried to make it working against multiple TYPO3
versions. Doing the same work again and again when having
multiple extension in the portfolio is a inefficient way.

To mitigate this, a dedicated package has been created now
to provide it in a central way and maintain it in one place.

This change replaces a custom implementation or the usage of
the TYPO3 implementation added with a source install of the
EXT:core system extension making the use easier.

The new package is added as development dependency and usage
throughout the functional tests are replaced and finaly the
custom implementation removed.

The package also provides a extended FunctionalTestCase,
which is also used to prepare for proper SiteSets based
functional frontend request testing by overriding a method
essential in this case to make it possible not to create
a sys_template record.

As a sideeffect we can now remove some phpstan error patterns,
which are properly defined and mitigated with the 3rd party
package.

Used command(s):

Build/Scripts/runTests.sh -p 8.1 -t 12 -s composer -- \
  require --dev \
  'sbuerk/typo3-site-based-test-trait':'^1.0.2 || ^2.0.1' \
&& Build/Scripts/runTests.sh -p 8.1 -t 12 -s composerUpdate \
&& Build/Scripts/runTests.sh -p 8.1 -t 12 -s cgl \
&& Build/Scripts/runTests.sh -p 8.1 -t 12 -s phpstanGenerateBaseline \
&& Build/Scripts/runTests.sh -p 8.2 -t 13 -s composerUpdate \
&& Build/Scripts/runTests.sh -p 8.2 -t 13 -s phpstanGenerateBaseline

To make frontend requests within functional tests a proper
frontend page setup is required, and TYPO3 uses internally
a `SiteBasedTestTrait` for own tests, which is not provided
in distrubtion packages.

Extension created and maintained there own versions, and in
some cased tried to make it working against multiple TYPO3
versions. Doing the same work again and again when having
multiple extension in the portfolio is a inefficient way.

To mitigate this, a dedicated package has been created now
to provide it in a central way and maintain it in one place.

This change replaces a custom implementation or the usage of
the TYPO3 implementation added with a source install of the
`EXT:core` system extension making the use easier.

The new package is added as development dependency and usage
throughout the functional tests are replaced and finaly the
custom implementation removed.

The package also provides a extended `FunctionalTestCase`,
which is also used to prepare for proper SiteSets based
functional frontend request testing by overriding a method
essential in this case to make it possible **not** to create
a `sys_template` record.

As a sideeffect we can now remove some phpstan error patterns,
which are properly defined and mitigated with the 3rd party
package.

Used command(s):

```shell
Build/Scripts/runTests.sh -p 8.1 -t 12 -s composer -- \
  require --dev \
  'sbuerk/typo3-site-based-test-trait':'^1.0.2 || ^2.0.1' \
&& Build/Scripts/runTests.sh -p 8.1 -t 12 -s composerUpdate \
&& Build/Scripts/runTests.sh -p 8.1 -t 12 -s cgl \
&& Build/Scripts/runTests.sh -p 8.1 -t 12 -s phpstanGenerateBaseline \
&& Build/Scripts/runTests.sh -p 8.2 -t 13 -s composerUpdate \
&& Build/Scripts/runTests.sh -p 8.2 -t 13 -s phpstanGenerateBaseline
```
@sbuerk sbuerk merged commit b98ecfa into main Apr 14, 2025
9 checks passed
@sbuerk sbuerk deleted the stefan-1 branch April 14, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants