Skip to content

Commit 839e7d0

Browse files
committed
[v13] changes for fluid 4 and TYPO3 13.3
1 parent 1bd5aeb commit 839e7d0

File tree

80 files changed

+911
-863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+911
-863
lines changed

.github/workflows/tests.yml

+14-6
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ jobs:
4040
max-parallel: 2
4141
matrix:
4242
php-versions: ['8.2', '8.3']
43-
typo3-versions: ['13.2', '12.4']
43+
typo3-versions: ['13.3', '12.4']
44+
composer-requirements: ['Min', 'Max']
45+
exclude:
46+
- typo3-versions: '13.3'
47+
composer-requirements: 'Max'
4448

45-
name: Unit Testing (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }})
49+
name: Unit (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }}, Req ${{ matrix.composer-requirements }})
4650
steps:
4751
- name: "Checkout"
4852
uses: actions/checkout@v4
@@ -58,7 +62,7 @@ jobs:
5862
restore-keys: "php${{ matrix.php-version }}-composer-\n"
5963

6064
- name: Install composer dependencies
61-
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerUpdateMin
65+
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerUpdate${{ matrix.composer-requirements }}
6266

6367
- name: Automated Unit Testing
6468
run: Build/Scripts/runTests.sh -s unit
@@ -70,9 +74,13 @@ jobs:
7074
max-parallel: 2
7175
matrix:
7276
php-versions: ['8.2', '8.3']
73-
typo3-versions: ['13.2', '12.4']
77+
typo3-versions: ['13.3', '12.4']
78+
composer-requirements: ['Min', 'Max']
79+
exclude:
80+
- typo3-versions: '13.3'
81+
composer-requirements: 'Max'
7482

75-
name: Functional Testing (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }})
83+
name: Functional (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }}, Req ${{ matrix.composer-requirements }})
7684
steps:
7785
- name: "Checkout"
7886
uses: actions/checkout@v4
@@ -88,7 +96,7 @@ jobs:
8896
restore-keys: "php${{ matrix.php-version }}-composer-\n"
8997

9098
- name: Install composer dependencies
91-
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerUpdateMin
99+
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerUpdate${{ matrix.composer-requirements }}
92100

93101
- name: Automated Unit Testing
94102
run: Build/Scripts/runTests.sh -s functional

Build/phpunit/FunctionalTestsBootstrap.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the TYPO3 CMS project.
44
*
@@ -12,8 +12,8 @@
1212
* The TYPO3 project - inspiring people to share!
1313
*/
1414

15-
call_user_func(function () {
16-
$testbase = new \TYPO3\TestingFramework\Core\Testbase();
15+
call_user_func(function (): void {
16+
$testbase = new TYPO3\TestingFramework\Core\Testbase();
1717
$testbase->defineOriginalRootPath();
1818
$testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/tests');
1919
$testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/transient');

Build/phpunit/UnitTestsBootstrap.php

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
* This file is part of the TYPO3 CMS project.
44
*
@@ -12,8 +12,8 @@
1212
* The TYPO3 project - inspiring people to share!
1313
*/
1414

15-
call_user_func(function () {
16-
$testbase = new \TYPO3\TestingFramework\Core\Testbase();
15+
call_user_func(function (): void {
16+
$testbase = new TYPO3\TestingFramework\Core\Testbase();
1717

1818
// These if's are for core testing (package typo3/cms) only. cms-composer-installer does
1919
// not create the autoload-include.php file that sets these env vars and sets composer
@@ -31,45 +31,45 @@
3131

3232
$testbase->defineSitePath();
3333

34-
$requestType = \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE | \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_CLI;
35-
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(0, $requestType);
34+
$requestType = TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE | TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_CLI;
35+
TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(0, $requestType);
3636

37-
$testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3conf/ext');
38-
$testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/assets');
39-
$testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/var/tests');
40-
$testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/var/transient');
37+
$testbase->createDirectory(TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3conf/ext');
38+
$testbase->createDirectory(TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/assets');
39+
$testbase->createDirectory(TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/var/tests');
40+
$testbase->createDirectory(TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/var/transient');
4141

4242
// Retrieve an instance of class loader and inject to core bootstrap
4343
$classLoader = require $testbase->getPackagesPath() . '/autoload.php';
44-
\TYPO3\CMS\Core\Core\Bootstrap::initializeClassLoader($classLoader);
44+
TYPO3\CMS\Core\Core\Bootstrap::initializeClassLoader($classLoader);
4545

4646
// Initialize default TYPO3_CONF_VARS
47-
$configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager();
47+
$configurationManager = new TYPO3\CMS\Core\Configuration\ConfigurationManager();
4848
$GLOBALS['TYPO3_CONF_VARS'] = $configurationManager->getDefaultConfiguration();
4949

50-
$cache = new \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend(
50+
$cache = new TYPO3\CMS\Core\Cache\Frontend\PhpFrontend(
5151
'core',
52-
new \TYPO3\CMS\Core\Cache\Backend\NullBackend('production', [])
52+
new TYPO3\CMS\Core\Cache\Backend\NullBackend('production', [])
5353
);
5454

5555
// Set all packages to active
56-
if (interface_exists(\TYPO3\CMS\Core\Package\Cache\PackageCacheInterface::class)) {
57-
$packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager(
58-
\TYPO3\CMS\Core\Package\UnitTestPackageManager::class,
59-
\TYPO3\CMS\Core\Core\Bootstrap::createPackageCache($cache)
56+
if (interface_exists(TYPO3\CMS\Core\Package\Cache\PackageCacheInterface::class)) {
57+
$packageManager = TYPO3\CMS\Core\Core\Bootstrap::createPackageManager(
58+
TYPO3\CMS\Core\Package\UnitTestPackageManager::class,
59+
TYPO3\CMS\Core\Core\Bootstrap::createPackageCache($cache)
6060
);
6161
} else {
6262
// v10 compatibility layer
63-
$packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager(
64-
\TYPO3\CMS\Core\Package\UnitTestPackageManager::class,
63+
$packageManager = TYPO3\CMS\Core\Core\Bootstrap::createPackageManager(
64+
TYPO3\CMS\Core\Package\UnitTestPackageManager::class,
6565
$cache
6666
);
6767
}
6868

69-
\TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Package\PackageManager::class, $packageManager);
70-
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::setPackageManager($packageManager);
69+
TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(TYPO3\CMS\Core\Package\PackageManager::class, $packageManager);
70+
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::setPackageManager($packageManager);
7171

7272
$testbase->dumpClassLoadingInformation();
7373

74-
\TYPO3\CMS\Core\Utility\GeneralUtility::purgeInstances();
74+
TYPO3\CMS\Core\Utility\GeneralUtility::purgeInstances();
7575
});

Classes/Command/CheckContentEscapingCommand.php

+22-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace SMS\FluidComponents\Command;
55

6+
use RuntimeException;
67
use SMS\FluidComponents\Fluid\ViewHelper\ComponentRenderer;
78
use SMS\FluidComponents\Utility\ComponentLoader;
89
use SMS\FluidComponents\ViewHelpers\SlotViewHelper;
@@ -12,8 +13,13 @@
1213
use Symfony\Component\Console\Output\OutputInterface;
1314
use Symfony\Component\Finder\Finder;
1415
use TYPO3\CMS\Core\Core\Environment;
16+
use TYPO3\CMS\Core\Information\Typo3Version;
1517
use TYPO3\CMS\Core\Package\PackageManager;
1618
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
19+
use TYPO3\CMS\Core\Utility\GeneralUtility;
20+
use TYPO3\CMS\Core\View\FluidViewAdapter;
21+
use TYPO3\CMS\Core\View\ViewFactoryData;
22+
use TYPO3\CMS\Core\View\ViewFactoryInterface;
1723
use TYPO3\CMS\Fluid\View\StandaloneView;
1824
use TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper;
1925
use TYPO3Fluid\Fluid\Core\Parser\ParsingState;
@@ -28,33 +34,33 @@ class CheckContentEscapingCommand extends Command
2834
{
2935
/**
3036
* List of ViewHelpers that are usually used to un-escape variables
31-
* that are passed as content to a component
37+
* that are passed as content to a component.
3238
*/
3339
public const RAW_VIEWHELPERS = [
3440
RawViewHelper::class,
35-
HtmlViewHelper::class
41+
HtmlViewHelper::class,
3642
];
3743

3844
/**
3945
* Variables that don't contain any HTML and thus don't need to be
40-
* checked
46+
* checked.
4147
*/
4248
public const IGNORED_VARIABLES = [
4349
'component.prefix',
44-
'component.class'
50+
'component.class',
4551
];
4652

4753
protected array $templates = [];
4854
protected array $results = [];
4955
protected array $affectedComponents = [];
5056
public function __construct(
5157
protected PackageManager $packageManager,
52-
protected ComponentLoader $componentLoader
58+
protected ComponentLoader $componentLoader,
5359
) {
5460
parent::__construct();
5561
}
5662

57-
protected function configure()
63+
protected function configure(): void
5864
{
5965
$this->setDescription(
6066
'Checks for possible escaping issues with content parameter due to new children escaping behavior'
@@ -192,7 +198,7 @@ public function detectEscapedVariablesPassedAsContent(NodeInterface $node): arra
192198
if (!empty($variableNames)) {
193199
$results[] = [
194200
$this->affectedComponents[$viewHelper->getComponentNamespace()],
195-
$variableNames
201+
$variableNames,
196202
];
197203
}
198204
continue;
@@ -298,6 +304,14 @@ protected function parseTemplate(string $file): ParsingState
298304

299305
protected function getTemplateParser(): TemplateParser
300306
{
301-
return (new StandaloneView())->getRenderingContext()->getTemplateParser();
307+
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
308+
return (new StandaloneView())->getRenderingContext()->getTemplateParser();
309+
}
310+
311+
$view = GeneralUtility::makeInstance(ViewFactoryInterface::class)->create(new ViewFactoryData());
312+
if ($view instanceof FluidViewAdapter) {
313+
return $view->getRenderingContext()->getTemplateParser();
314+
}
315+
throw new RuntimeException('view must be an instance of \TYPO3\CMS\Core\View\FluidViewAdapter', 1726643308);
302316
}
303317
}

Classes/Command/GenerateXsdCommand.php

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace SMS\FluidComponents\Command;
44

5+
use Exception;
56
use SMS\FluidComponents\Service\XsdGenerator;
67
use Symfony\Component\Console\Command\Command;
78
use Symfony\Component\Console\Input\InputArgument;
@@ -16,19 +17,19 @@ public function __construct(private XsdGenerator $xsdGenerator)
1617
parent::__construct();
1718
}
1819

19-
protected function configure()
20+
protected function configure(): void
2021
{
2122
$this->setDescription(
2223
'Generates xsd files for all fluid-components'
2324
);
2425
$this->setHelp(
2526
<<<'EOH'
26-
Generates Schema documentation (XSD) for your fluid components, preparing the
27-
file to be placed online and used by any XSD-aware editor.
28-
After creating the XSD file, reference it in your IDE and import the namespace
29-
in your Fluid template by adding the xmlns:* attribute(s):
30-
<code><html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" ...></code>
31-
EOH
27+
Generates Schema documentation (XSD) for your fluid components, preparing the
28+
file to be placed online and used by any XSD-aware editor.
29+
After creating the XSD file, reference it in your IDE and import the namespace
30+
in your Fluid template by adding the xmlns:* attribute(s):
31+
<code><html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" ...></code>
32+
EOH
3233
);
3334
$this->addArgument(
3435
'path',
@@ -55,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5556
$output->writeln('Path: ' . $path);
5657
}
5758
if (!is_dir($path)) {
58-
throw new \Exception('Directory \'' . $input->getArgument('path') . '\' does not exist.', 1582535395);
59+
throw new Exception('Directory \'' . $input->getArgument('path') . '\' does not exist.', 1582535395);
5960
}
6061
$xsdTargetNameSpaces = $this->xsdGenerator->generateXsd($path, $input->getOption('namespace'));
6162
if (count($xsdTargetNameSpaces) === 0) {

Classes/Domain/Model/DateTime.php

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace SMS\FluidComponents\Domain\Model;
44

5+
use DateTimeImmutable;
6+
use DateTimeInterface;
57
use Exception;
68
use SMS\FluidComponents\Interfaces\ConstructibleFromDateTime;
79
use SMS\FluidComponents\Interfaces\ConstructibleFromDateTimeImmutable;
@@ -11,7 +13,7 @@
1113
class DateTime extends \DateTime implements ConstructibleFromString, ConstructibleFromInteger, ConstructibleFromDateTime, ConstructibleFromDateTimeImmutable
1214
{
1315
/**
14-
* Convert string input to datetime object
16+
* Convert string input to datetime object.
1517
*
1618
* @throws Exception
1719
*/
@@ -21,7 +23,7 @@ public static function fromString(string $value): object
2123
}
2224

2325
/**
24-
* Convert UNIX timestamp to datetime object
26+
* Convert UNIX timestamp to datetime object.
2527
*
2628
* @throws Exception
2729
*/
@@ -31,22 +33,22 @@ public static function fromInteger(int $value): self
3133
}
3234

3335
/**
34-
* Passes datetime object
36+
* Passes datetime object.
3537
*
3638
* @throws Exception
3739
*/
3840
public static function fromDateTime(\DateTime $value): self
3941
{
40-
return new static($value->format(\DateTimeInterface::RFC3339_EXTENDED));
42+
return new static($value->format(DateTimeInterface::RFC3339_EXTENDED));
4143
}
4244

4345
/**
44-
* Passes immutable datetime object
46+
* Passes immutable datetime object.
4547
*
4648
* @throws Exception
4749
*/
48-
public static function fromDateTimeImmutable(\DateTimeImmutable $value): self
50+
public static function fromDateTimeImmutable(DateTimeImmutable $value): self
4951
{
50-
return new static($value->format(\DateTimeInterface::RFC3339_EXTENDED));
52+
return new static($value->format(DateTimeInterface::RFC3339_EXTENDED));
5153
}
5254
}

Classes/Domain/Model/FalFile.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace SMS\FluidComponents\Domain\Model;
44

55
use SMS\FluidComponents\Domain\Model\Traits\FalFileTrait;
66

77
/**
8-
* Data structure as a wrapper around a FAL object to be passed to a component
8+
* Data structure as a wrapper around a FAL object to be passed to a component.
99
*/
1010
class FalFile extends File
1111
{
1212
use FalFileTrait;
1313

1414
/**
15-
* Type of file to differentiate implementations in Fluid templates
15+
* Type of file to differentiate implementations in Fluid templates.
1616
*/
1717
protected string $type = 'FalFile';
1818
}

Classes/Domain/Model/FalImage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace SMS\FluidComponents\Domain\Model;
44

55
use SMS\FluidComponents\Domain\Model\Traits\FalFileTrait;
66

77
/**
8-
* Data structure as a wrapper around a FAL object to be passed to a component
8+
* Data structure as a wrapper around a FAL object to be passed to a component.
99
*/
1010
class FalImage extends Image
1111
{
1212
use FalFileTrait;
1313

1414
/**
15-
* Type of image to differentiate implementations in Fluid templates
15+
* Type of image to differentiate implementations in Fluid templates.
1616
*/
1717
protected string $type = 'FalImage';
1818

0 commit comments

Comments
 (0)