Skip to content

Commit

Permalink
WIP|Support TYPO3 v12
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DanielSiepmann committed Feb 19, 2024
1 parent 40937ed commit 6fee803
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 79 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
strategy:
matrix:
php-version:
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
Expand Down Expand Up @@ -69,11 +67,18 @@ jobs:
strategy:
matrix:
include:
- php-version: '7.4'
- php-version: '8.0'
- 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

Expand All @@ -86,7 +91,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)
Expand All @@ -97,11 +102,18 @@ jobs:
strategy:
matrix:
include:
- php-version: '7.4'
- php-version: '8.0'
- 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

Expand All @@ -126,7 +138,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:
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/WatchlistController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(
protected function initializeAction(): void
{
if ($this->request->hasArgument('watchlist') === false) {
$this->request->setArgument('watchlist', 'default');
$this->request = $this->request->withArgument('watchlist', 'default');
}
}

Expand Down
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,14 @@ 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.

* Drop Support for older PHP versions.
This would make maintenance harder as ecosystem doesn't always support those old versions.
2 changes: 1 addition & 1 deletion Tests/Fixtures/watchlist_example/Classes/ItemHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private function getPageRecord(int $uid): array
$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
Expand Down
47 changes: 24 additions & 23 deletions Tests/Functional/BasicsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,33 @@

class BasicsTest extends FunctionalTestCase
{
protected $coreExtensionsToLoad = [
'fluid_styled_content',
];

protected $testExtensionsToLoad = [
'typo3conf/ext/watchlist',
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
];

protected $pathsToLinkInTestInstance = [
'typo3conf/ext/watchlist/Tests/Fixtures/Sites' => 'typo3conf/sites',
'typo3conf/ext/watchlist/Tests/Fixtures/Fileadmin/Files' => 'fileadmin/Files',
];

protected $configurationToUseInTestInstance = [
'FE' => [
'cacheHash' => [
'excludedParameters' => [
'^tx_watchlist_watchlist[',
protected function setUp(): void
{
$this->coreExtensionsToLoad = [
'typo3/cms-fluid-styled-content',
'typo3/cms-form',
];

$this->testExtensionsToLoad = [
'werkraummedia/watchlist',
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
];

$this->pathsToLinkInTestInstance = [
'typo3conf/ext/watchlist/Tests/Fixtures/Sites' => 'typo3conf/sites',
'typo3conf/ext/watchlist/Tests/Fixtures/Fileadmin/Files' => 'fileadmin/Files',
];

$this->configurationToUseInTestInstance = [
'FE' => [
'cacheHash' => [
'excludedParameters' => [
'^tx_watchlist_watchlist[',
],
],
],
],
];
];

protected function setUp(): void
{
parent::setUp();

$this->importCSVDataSet(__DIR__ . '/../Fixtures/BasicDatabase.csv');
Expand Down
29 changes: 14 additions & 15 deletions Tests/Functional/FormIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,23 @@

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',
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
];
$this->testExtensionsToLoad = [
'werkraummedia/watchlist',
'typo3conf/ext/watchlist/Tests/Fixtures/watchlist_example',
];

protected $pathsToLinkInTestInstance = [
'typo3conf/ext/watchlist/Tests/Fixtures/Sites' => 'typo3conf/sites',
'typo3conf/ext/watchlist/Tests/Fixtures/Fileadmin/Files' => 'fileadmin/Files',
];
$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');
Expand Down
30 changes: 16 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,31 @@
}
},
"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"
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"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": "^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,
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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\\.$#"
17 changes: 7 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -26,11 +23,11 @@
</testsuite>
</testsuites>

<coverage>
<source>
<include>
<directory suffix=".php">Classes</directory>
</include>
</coverage>
</source>

<php>
<env name="typo3DatabaseDriver" value="pdo_sqlite"/>
Expand Down
11 changes: 7 additions & 4 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{ pkgs ? import <nixpkgs> { } }:

let
php = pkgs.php81;
composer = pkgs.php81Packages.composer;
php = pkgs.php82;
inherit(pkgs.php81Packages) composer;

projectInstall = pkgs.writeShellApplication {
name = "project-install";
runtimeInputs = [
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 {
Expand Down Expand Up @@ -60,7 +61,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
Expand All @@ -77,6 +78,8 @@ in pkgs.mkShell {
projectValidateXml
projectCodingGuideline
projectTestAcceptance
php
composer
];

shellHook = ''
Expand Down

0 comments on commit 6fee803

Please sign in to comment.