From b1e6187ed2ccfe72a3e6d5e166fc8ec70177a754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Thu, 12 Dec 2024 11:34:52 +0100 Subject: [PATCH 1/2] [TASK] Update to `typo3/testing-framework` version 8.x `typo3/testing-framework` supports testing against two TYPO3 versions per TF version and the current used 7.x supports only TYPO3 v11 and v12. After TYPO3 v11 support has been dropped, this change upgrades the development dependency to the next version and bolldozes the towards adding TYPO3 v13 as second supported TYPO3 version. Used command(s): ```shell composer require --dev \ "typo3/testing-framework":"^8.2.7" ``` --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f8b13ee1..4ad581f0 100644 --- a/composer.json +++ b/composer.json @@ -108,7 +108,7 @@ "typo3/cms-rte-ckeditor": "^12.4.2", "typo3/cms-tstemplate": "^12.4.2", "typo3/cms-workspaces": "^12.4.2", - "typo3/testing-framework": "^7.1.1" + "typo3/testing-framework": "^8.2.7" }, "suggest": { "b13/container": "Just to be loaded after EXT:container", From eee87a3e2065ca2d7debecfed45c1d679c8fde80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Thu, 12 Dec 2024 12:00:47 +0100 Subject: [PATCH 2/2] [TASK] Use better suiting typing in `SiteBasedTestTrait` The `SiteBasedTestTrait` uses `AbstractInstruction` to declare native types for method arguments and return types and PHPStan complains about this because `typo3/testing-framework` methods uses the `InstructionInterface` instead. This change adopts `InstructionInterface` type hints to be in line with the `typo3/testing-framework` and satisfy PHPStan, which allows us to remove no longer matched ignored errors from the PHPStan baseline. Used command(s): ```shell Build/Scripts/runTests.sh -t 12 -p 8.1 -s phpstanGenerateBaseline ``` --- Build/phpstan/Core12/phpstan-baseline.neon | 25 ------------------- .../Fixtures/Traits/SiteBasedTestTrait.php | 10 ++++---- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/Build/phpstan/Core12/phpstan-baseline.neon b/Build/phpstan/Core12/phpstan-baseline.neon index 1b117626..1a3590c5 100644 --- a/Build/phpstan/Core12/phpstan-baseline.neon +++ b/Build/phpstan/Core12/phpstan-baseline.neon @@ -260,11 +260,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Hooks/TranslateHookTest.php - - - message: "#^Parameter \\#1 \\$current of method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Hooks\\\\TranslateHookTest\\:\\:mergeInstruction\\(\\) expects TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction, TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction\\|null given\\.$#" - count: 1 - path: ../../../Tests/Functional/Hooks/TranslateHookTest.php - - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Regression\\\\GlossaryRegressionTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -315,11 +310,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/GlossaryRegressionTest.php - - - message: "#^Parameter \\#1 \\$current of method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Regression\\\\GlossaryRegressionTest\\:\\:mergeInstruction\\(\\) expects TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction, TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction\\|null given\\.$#" - count: 1 - path: ../../../Tests/Functional/Regression/GlossaryRegressionTest.php - - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -370,11 +360,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php - - - message: "#^Parameter \\#1 \\$current of method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:mergeInstruction\\(\\) expects TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction, TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction\\|null given\\.$#" - count: 1 - path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php - - message: "#^Cannot access property \\$code on DeepL\\\\Language\\|null\\.$#" count: 7 @@ -430,11 +415,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Services/LanguageServiceTest.php - - - message: "#^Parameter \\#1 \\$current of method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Services\\\\LanguageServiceTest\\:\\:mergeInstruction\\(\\) expects TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction, TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction\\|null given\\.$#" - count: 1 - path: ../../../Tests/Functional/Services/LanguageServiceTest.php - - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -484,8 +464,3 @@ parameters: message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:writeSiteConfiguration\\(\\) has parameter \\$site with no value type specified in iterable type array\\.$#" count: 1 path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php - - - - message: "#^Parameter \\#1 \\$current of method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:mergeInstruction\\(\\) expects TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction, TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction\\|null given\\.$#" - count: 1 - path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php diff --git a/Tests/Functional/Fixtures/Traits/SiteBasedTestTrait.php b/Tests/Functional/Fixtures/Traits/SiteBasedTestTrait.php index 55b541de..6f5ef39d 100644 --- a/Tests/Functional/Fixtures/Traits/SiteBasedTestTrait.php +++ b/Tests/Functional/Fixtures/Traits/SiteBasedTestTrait.php @@ -8,8 +8,8 @@ use TYPO3\CMS\Core\Configuration\SiteConfiguration; use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\AbstractInstruction; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\ArrayValueInstruction; +use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\InstructionInterface; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\TypoScriptInstruction; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; use WebVision\Deepltranslate\Core\Tests\Functional\Fixtures\Frontend\PhpError; @@ -242,13 +242,13 @@ protected function resolveLanguagePreset(string $identifier) /** * @todo Instruction handling should be part of Testing Framework (multiple instructions per identifier, merge in interface) */ - protected function applyInstructions(InternalRequest $request, AbstractInstruction ...$instructions): InternalRequest + protected function applyInstructions(InternalRequest $request, InstructionInterface ...$instructions): InternalRequest { $modifiedInstructions = []; - + $instructions = array_filter($instructions); foreach ($instructions as $instruction) { $identifier = $instruction->getIdentifier(); - if (isset($modifiedInstructions[$identifier]) || $request->getInstruction($identifier) !== null) { + if (($modifiedInstructions[$identifier] ?? $request->getInstruction($identifier)) !== null) { $modifiedInstructions[$identifier] = $this->mergeInstruction( $modifiedInstructions[$identifier] ?? $request->getInstruction($identifier), $instruction @@ -261,7 +261,7 @@ protected function applyInstructions(InternalRequest $request, AbstractInstructi return $request->withInstructions($modifiedInstructions); } - protected function mergeInstruction(AbstractInstruction $current, AbstractInstruction $other): AbstractInstruction + protected function mergeInstruction(InstructionInterface $current, InstructionInterface $other): InstructionInterface { if (get_class($current) !== get_class($other)) { throw new LogicException('Cannot merge different instruction types', 1565863174);