WIP|Support TYPO3 v12

WIP:
    * Migrate CSV to PHP in order to have conditions to load columns
      based on current TYPO3 version.
    * Pass tests
    * Migrate controller setArgument() to keep working version for v11.
This commit is contained in:
Daniel Siepmann 2023-04-19 11:40:15 +02:00
parent 40937edef4
commit 6d3b93ddb7
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
10 changed files with 119 additions and 75 deletions

View file

@ -70,10 +70,23 @@ jobs:
matrix: matrix:
include: include:
- php-version: '7.4' - php-version: '7.4'
typo3-version: '^11.5'
- php-version: '8.0' - php-version: '8.0'
typo3-version: '^11.5'
- php-version: '8.0'
typo3-version: '^11.5'
- php-version: '8.1' - php-version: '8.1'
typo3-version: '^11.5'
- php-version: '8.2' - php-version: '8.2'
typo3-version: '^11.5'
- php-version: '8.3' - php-version: '8.3'
typo3-version: '^11.5'
- php-version: '8.1'
typo3-version: '^12.4'
- php-version: '8.2'
typo3-version: '^12.4'
- php-version: '8.3'
typo3-version: '^12.4'
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -86,7 +99,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: |- run: |-
composer require --no-interaction --prefer-dist --no-progress composer req "typo3/cms-core:${{ matrix.typo3-version }}" --prefer-dist --no-progress --no-interaction
./vendor/bin/codecept build ./vendor/bin/codecept build
- name: Code Quality (by PHPStan) - name: Code Quality (by PHPStan)
@ -98,10 +111,21 @@ jobs:
matrix: matrix:
include: include:
- php-version: '7.4' - php-version: '7.4'
typo3-version: '^11.5'
- php-version: '8.0' - php-version: '8.0'
typo3-version: '^11.5'
- php-version: '8.1' - php-version: '8.1'
typo3-version: '^11.5'
- php-version: '8.2' - php-version: '8.2'
typo3-version: '^11.5'
- php-version: '8.3' - php-version: '8.3'
typo3-version: '^11.5'
- php-version: '8.1'
typo3-version: '^12.4'
- php-version: '8.2'
typo3-version: '^12.4'
- php-version: '8.3'
typo3-version: '^12.4'
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -126,7 +150,7 @@ jobs:
done done
- name: Install dependencies - name: Install dependencies
run: composer install --no-interaction --prefer-dist --no-progress run: composer req "typo3/cms-core:${{ matrix.typo3-version }}" --prefer-dist --no-progress --no-interaction
- name: PHPUnit Tests - name: PHPUnit Tests
env: env:

View file

@ -44,7 +44,7 @@ class WatchlistController extends ActionController
protected function initializeAction(): void protected function initializeAction(): void
{ {
if ($this->request->hasArgument('watchlist') === false) { if ($this->request->hasArgument('watchlist') === false) {
$this->request->setArgument('watchlist', 'default'); $this->request = $this->request->withArgument('watchlist', 'default');
} }
} }

View file

@ -151,3 +151,11 @@ Example
A concrete example can be found within ``Tests/Fixtures/FrontendRendering.typoscript``. A concrete example can be found within ``Tests/Fixtures/FrontendRendering.typoscript``.
This example includes the provided JavaScript file as well as some custom CSS and Markup. This example includes the provided JavaScript file as well as some custom CSS and Markup.
The content element is not necessary. The content element is not necessary.
Changelog
=========
v1.1.0
------
* Add Support for TYPO3 v12 and newer PHP versions.

View file

@ -67,7 +67,7 @@ class ItemHandler implements ItemHandlerInterface
$qb->from('pages'); $qb->from('pages');
$qb->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))); $qb->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)));
$qb->setMaxResults(1); $qb->setMaxResults(1);
return $qb->execute()->fetchAssociative() ?: []; return $qb->executeQuery()->fetchAssociative() ?: [];
} }
private function getImage(int $uid): ?FileReference private function getImage(int $uid): ?FileReference

View file

@ -30,21 +30,24 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
class BasicsTest extends FunctionalTestCase class BasicsTest extends FunctionalTestCase
{ {
protected $coreExtensionsToLoad = [ protected function setUp(): void
'fluid_styled_content', {
$this->coreExtensionsToLoad = [
'typo3/cms-fluid-styled-content',
'typo3/cms-form',
]; ];
protected $testExtensionsToLoad = [ $this->testExtensionsToLoad = [
'typo3conf/ext/watchlist', 'werkraummedia/watchlist',
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example', 'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
]; ];
protected $pathsToLinkInTestInstance = [ $this->pathsToLinkInTestInstance = [
'typo3conf/ext/watchlist/Tests/Fixtures/Sites' => 'typo3conf/sites', 'typo3conf/ext/watchlist/Tests/Fixtures/Sites' => 'typo3conf/sites',
'typo3conf/ext/watchlist/Tests/Fixtures/Fileadmin/Files' => 'fileadmin/Files', 'typo3conf/ext/watchlist/Tests/Fixtures/Fileadmin/Files' => 'fileadmin/Files',
]; ];
protected $configurationToUseInTestInstance = [ $this->configurationToUseInTestInstance = [
'FE' => [ 'FE' => [
'cacheHash' => [ 'cacheHash' => [
'excludedParameters' => [ 'excludedParameters' => [
@ -54,8 +57,6 @@ class BasicsTest extends FunctionalTestCase
], ],
]; ];
protected function setUp(): void
{
parent::setUp(); parent::setUp();
$this->importCSVDataSet(__DIR__ . '/../Fixtures/BasicDatabase.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/BasicDatabase.csv');

View file

@ -28,24 +28,23 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
class FormIntegrationTest extends FunctionalTestCase class FormIntegrationTest extends FunctionalTestCase
{ {
protected $coreExtensionsToLoad = [ protected function setUp(): void
'fluid_styled_content', {
'form', $this->coreExtensionsToLoad = [
'tstemplate', 'typo3/cms-fluid-styled-content',
'typo3/cms-form',
]; ];
protected $testExtensionsToLoad = [ $this->testExtensionsToLoad = [
'typo3conf/ext/watchlist', 'werkraummedia/watchlist',
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example', 'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
]; ];
protected $pathsToLinkInTestInstance = [ $this->pathsToLinkInTestInstance = [
'typo3conf/ext/watchlist/Tests/Fixtures/Sites' => 'typo3conf/sites', 'typo3conf/ext/watchlist/Tests/Fixtures/Sites' => 'typo3conf/sites',
'typo3conf/ext/watchlist/Tests/Fixtures/Fileadmin/Files' => 'fileadmin/Files', 'typo3conf/ext/watchlist/Tests/Fixtures/Fileadmin/Files' => 'fileadmin/Files',
]; ];
protected function setUp(): void
{
parent::setUp(); parent::setUp();
$this->importCSVDataSet(__DIR__ . '/../Fixtures/BasicDatabase.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/BasicDatabase.csv');

View file

@ -31,28 +31,30 @@
}, },
"require": { "require": {
"php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"typo3/cms-backend": "^11.5", "typo3/cms-backend": "^11.5 || ^12.4",
"typo3/cms-core": "^11.5", "typo3/cms-core": "^11.5 || ^12.4",
"typo3/cms-extbase": "^11.5", "typo3/cms-extbase": "^11.5 || ^12.4",
"typo3/cms-frontend": "^11.5" "typo3/cms-fluid-styled-content": "^11.5 || ^12.4",
"typo3/cms-form": "^11.5 || ^12.4",
"typo3/cms-frontend": "^11.5 || ^12.4"
}, },
"require-dev": { "require-dev": {
"codeception/codeception": "^4.2", "codeception/codeception": "^5.0",
"codeception/module-webdriver": "^2.0", "codeception/module-webdriver": "^3.2",
"cweagans/composer-patches": "^1.7", "cweagans/composer-patches": "^1.7",
"friendsofphp/php-cs-fixer": "^3.11", "friendsofphp/php-cs-fixer": "^3.11",
"phpstan/extension-installer": "^1.1", "phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "1.1.0", "phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5", "saschaegerer/phpstan-typo3": "^1.8",
"saschaegerer/phpstan-typo3": "^1.1", "typo3/testing-framework": "^7.0 || ^8.0"
"typo3/cms-fluid-styled-content": "^11.5",
"typo3/cms-form": "^11.5",
"typo3/cms-tstemplate": "^11.5",
"typo3/testing-framework": "^6.6"
}, },
"minimum-stability": "dev",
"prefer-stable": true,
"lock": false,
"config": { "config": {
"sort-packages": true, "sort-packages": true,
"lock": false,
"allow-plugins": { "allow-plugins": {
"typo3/cms-composer-installers": true, "typo3/cms-composer-installers": true,
"typo3/class-alias-loader": true, "typo3/class-alias-loader": true,

View file

@ -9,6 +9,3 @@ parameters:
checkMissingIterableValueType: false checkMissingIterableValueType: false
reportUnmatchedIgnoredErrors: true reportUnmatchedIgnoredErrors: true
checkGenericClassInNonGenericObjectType: false checkGenericClassInNonGenericObjectType: false
ignoreErrors:
- "#^Cannot call method fetchAssociative\\(\\) on Doctrine\\\\DBAL\\\\Result\\|int\\.$#"
- "#^Right side of \\|\\| is always false\\.$#"

View file

@ -1,22 +1,19 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<phpunit <phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false" backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php" bootstrap="vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
colors="true" colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
processIsolation="false" processIsolation="false"
stopOnError="false" stopOnError="false"
stopOnFailure="false" stopOnFailure="false"
stopOnIncomplete="false" stopOnIncomplete="false"
stopOnSkipped="false" stopOnSkipped="false"
verbose="false" cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
requireCoverageMetadata="false"
> >
<testsuites> <testsuites>
<testsuite name="unit"> <testsuite name="unit">
<directory>Tests/Unit/</directory> <directory>Tests/Unit/</directory>
@ -26,11 +23,11 @@
</testsuite> </testsuite>
</testsuites> </testsuites>
<coverage> <source>
<include> <include>
<directory suffix=".php">Classes</directory> <directory suffix=".php">Classes</directory>
</include> </include>
</coverage> </source>
<php> <php>
<env name="typo3DatabaseDriver" value="pdo_sqlite"/> <env name="typo3DatabaseDriver" value="pdo_sqlite"/>

View file

@ -1,8 +1,21 @@
{ pkgs ? import <nixpkgs> { } }: {
pkgs ? import <nixpkgs> { }
,phps ? import <phps>
}:
let let
php = pkgs.php81; php = phps.packages.x86_64-linux.php83.buildEnv {
composer = pkgs.php81Packages.composer; extensions = { enabled, all }: enabled ++ (with all; [
xdebug
]);
extraConfig = ''
xdebug.mode = debug
memory_limit = 4G
'';
};
inherit(php.packages) composer;
projectInstall = pkgs.writeShellApplication { projectInstall = pkgs.writeShellApplication {
name = "project-install"; name = "project-install";
@ -10,7 +23,8 @@ let
composer composer
]; ];
text = '' text = ''
composer install --prefer-dist --no-progress --working-dir="$PROJECT_ROOT" rm -rf .Build/ vendor/
composer update --prefer-dist --no-progress --working-dir="$PROJECT_ROOT"
''; '';
}; };
projectValidateComposer = pkgs.writeShellApplication { projectValidateComposer = pkgs.writeShellApplication {
@ -60,7 +74,7 @@ let
text = '' text = ''
project-install project-install
export INSTANCE_PATH="$PROJECT_ROOT/.Build/web/typo3temp/var/tests/acceptance/" export INSTANCE_PATH="$PROJECT_ROOT/.Build/web/typo3temp/var/tests/acceptance"
mkdir -p "$INSTANCE_PATH" mkdir -p "$INSTANCE_PATH"
./vendor/bin/codecept run ./vendor/bin/codecept run
@ -77,6 +91,8 @@ in pkgs.mkShell {
projectValidateXml projectValidateXml
projectCodingGuideline projectCodingGuideline
projectTestAcceptance projectTestAcceptance
php
composer
]; ];
shellHook = '' shellHook = ''