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:
include:
- php-version: '7.4'
typo3-version: '^11.5'
- php-version: '8.0'
typo3-version: '^11.5'
- php-version: '8.0'
typo3-version: '^11.5'
- php-version: '8.1'
typo3-version: '^11.5'
- php-version: '8.2'
typo3-version: '^11.5'
- 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:
- uses: actions/checkout@v3
@ -86,7 +99,7 @@ jobs:
- name: Install dependencies
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
- name: Code Quality (by PHPStan)
@ -98,10 +111,21 @@ jobs:
matrix:
include:
- php-version: '7.4'
typo3-version: '^11.5'
- php-version: '8.0'
typo3-version: '^11.5'
- php-version: '8.1'
typo3-version: '^11.5'
- php-version: '8.2'
typo3-version: '^11.5'
- 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:
- uses: actions/checkout@v3
@ -126,7 +150,7 @@ jobs:
done
- 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
env:

View file

@ -44,7 +44,7 @@ class WatchlistController extends ActionController
protected function initializeAction(): void
{
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``.
This example includes the provided JavaScript file as well as some custom CSS and Markup.
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->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)));
$qb->setMaxResults(1);
return $qb->execute()->fetchAssociative() ?: [];
return $qb->executeQuery()->fetchAssociative() ?: [];
}
private function getImage(int $uid): ?FileReference

View file

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

View file

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

View file

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

View file

@ -9,6 +9,3 @@ parameters:
checkMissingIterableValueType: false
reportUnmatchedIgnoredErrors: true
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"?>
<phpunit
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"
backupStaticAttributes="false"
bootstrap="vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
requireCoverageMetadata="false"
>
<testsuites>
<testsuite name="unit">
<directory>Tests/Unit/</directory>
@ -26,11 +23,11 @@
</testsuite>
</testsuites>
<coverage>
<source>
<include>
<directory suffix=".php">Classes</directory>
</include>
</coverage>
</source>
<php>
<env name="typo3DatabaseDriver" value="pdo_sqlite"/>

View file

@ -1,8 +1,21 @@
{ pkgs ? import <nixpkgs> { } }:
{
pkgs ? import <nixpkgs> { }
,phps ? import <phps>
}:
let
php = pkgs.php81;
composer = pkgs.php81Packages.composer;
php = phps.packages.x86_64-linux.php83.buildEnv {
extensions = { enabled, all }: enabled ++ (with all; [
xdebug
]);
extraConfig = ''
xdebug.mode = debug
memory_limit = 4G
'';
};
inherit(php.packages) composer;
projectInstall = pkgs.writeShellApplication {
name = "project-install";
@ -10,7 +23,8 @@ let
composer
];
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 {
@ -60,7 +74,7 @@ let
text = ''
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"
./vendor/bin/codecept run
@ -77,6 +91,8 @@ in pkgs.mkShell {
projectValidateXml
projectCodingGuideline
projectTestAcceptance
php
composer
];
shellHook = ''