Download the PHP package sbuerk/typo3-site-based-test-trait without Composer

On this page you can find all versions of the php package sbuerk/typo3-site-based-test-trait. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package typo3-site-based-test-trait

Provides modified TYPO3 SiteBasedTestTrait

Compatibility

branch version TYPO3 testing-framework PHP CI State
main 3.x.x-dev main,14.0.0-dev main, 9 8.2, 8.3, 8.4 CI
2 2.x.x-dev 13.4,13.4.x-dev 8,9 8.2, 8.3, 8.4 CI
1 1.x.x-dev 12.4,12.4.x-dev 8 8.1, 8.2, 8.3, 8.4 CI

Description

This package aims to provide a slightly extended (modified) SiteBasedTestTrait to allow easier usage for functional test TYPO3 Extensions or projects, hiding away internal requirements and cross TYPO3 Core Version changes introduced over time.

TYPO3 Core provides the trait only in the test namespace, stripped from distribution composer packages and are not available out of the box. It is possible to tell composer to install the package from source and requiring to add the TYPO3 system extension test namespace to the own root composer.json, which can easily be missed. This package makes the life easier.

Additionally, a custom FunctionalTestCase extending the typo3/testing-framework counter-part is provided with a modified setUpFrontendRootPage() method in preparation for TYPO3 v13 to make it possible to init site roots without creating a sys_template to make it possible to write site sets based templates. This is already provided for the TYPO3 v12 variante to have the same API in place to ensure working state without static code analysis errors when multiple core version tests are used, like it is the case for extensions.

[!IMPORTANT] This should still be taken as experimental. It is tried hard to provide the same outer surface across versions as long as possible, but this cannot be guaranteed.

Installation

[!NOTE] This package should only be installed as development dependency and not deployed to production instances. It does not serve any purpose in production code.

Extension authors may support multiple TYPO3 versions with one extension version and needs to have working SiteBasedTestTrait for the corresponding TYPO3 version, which changes under the hood. To make maintenance and static code analysises easier, this package supports only one core version per version and extension authors needs to add conditional constraints for this package and let composer install the suitable version along with other dependencies, for example to suppor TYPO3 v12 and v13:

Differences to the TYPO3 Core implementation of SiteBasedTestTrait

Fail test instead of mark it as skipped

In case that something went wrong, language could not found in the preset and similar the TYPO3 implementation marks the test as skipped and literally hiding away issues which are hard to identify and find.

This package changes them and let tests fail when these things happen to point directly to an issue in the tests.

Better code annotation

The annotations of the core are simple, related to the lower PHPStan level used. That produces a lot of noise in projects or extensions using PHPStan on a higher level and requires to add them to the baseline for each FunctionalTestCase.

To mitigate this, the annotations are enhanced for the cloned trait to survive higher PHPStan levels directly checked as part of the package testing.

writeSiteConfiguration()

The SiteBasedTestTrait::writeSiteConfiguration() method got a additional argument array $additional, which can be used to provide additional SiteConfig content, for example routing information.

Example Usage

[!IMPORTANT] TYPO3 v13 introduced array $dependency as 4th argument, which is removed in this implementation in favour of the more generic custom array $additional to keep same signature across package versions.

To add SiteSets dependency add it as part of the $additional array instead of the not adopted array $dependencies in TYPO3 v13:

buildSiteConfiguration()

This method got a additional argument $additionalRootConfiguration, which also allows to add custom things on root level to the SiteConfiguation similar to writeSiteConfiguration() argument additional.

Method signature:

LANGUAGE_PRESETS class property

TYPO3 has a strong limitation which is read from the LANGUAGE_PRESETS class property, which is extended to allow custom values for language definitions in the SiteConfiguration, which web-vision/deepltranslate-core uses as an example.

Extended FunctionalTestCase

A extended FunctionalTestCase is provided with a modified setUpFrontendRootPage() method.

FunctionalTestCase::setUpFrontendRootPage()

Signature of modified method:

The main differnce is the 4th parameter. If this is set to false, no sys_template record is created for the given $pageId - and silently ignoring $typoScriptFiles and $templateValues.

To simply ensure page is set as rootpage without creating a sys_template row, following is enough:

of without named arguments:

Create a release (maintainer only)

Prerequisites:

Checkout the release branch and

No need to create GitHub release manually - the publish workflow takes care of this.


All versions of typo3-site-based-test-trait with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2 || ^8.3 || ^8.4
ext-json Version *
typo3/cms-core Version 13.*.*@dev
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sbuerk/typo3-site-based-test-trait contains the following files

Loading the files please wait ....