From 352a4cdcd0029b68deaeab29be8c4825a65c9736 Mon Sep 17 00:00:00 2001 From: Achim Fritz Date: Wed, 26 Nov 2025 07:34:38 +0100 Subject: [PATCH] [TASK] v14 functional tests --- .github/workflows/ci.yml | 4 ++ Build/Scripts/runTests.sh | 5 +- Build/phpstan-baseline-11-7.4.neon | 21 +++++++- Build/phpstan-baseline-11.neon | 21 +++++++- Build/phpstan-baseline-12.neon | 21 +++++++- Build/phpstan-baseline-13.neon | 29 +++++++++++ .../CopyToLanguageSortingTest.php | 4 +- .../Datahandler/Localization/LocalizeTest.php | 52 ++++++++++++------- .../Functional/Frontend/AbstractFrontend.php | 13 +++++ Tests/Functional/Integrity/IntegrityTest.php | 38 ++++++++++++-- 10 files changed, 176 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ac1cc26..fc818769 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,10 @@ jobs: run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s functional if: matrix.TYPO3 != '14' + - name: Functional Tests 14 + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s functional -- --exclude-group content_defender + if: matrix.TYPO3 == '14' + - name: Acceptance Tests run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s acceptance -- --fail-fast if: matrix.TYPO3 != '14' diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 681a18d1..d0193604 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -641,10 +641,7 @@ case ${TEST_SUITE} in mv composer.json.orig composer.json ;; functional) - PHPUNIT_EXCLUDE_GROUPS+=",not-${DBMS}" - PHPUNIT_EXCLUDE_GROUPS="${PHPUNIT_EXCLUDE_GROUPS#,}" - PHPUNIT_EXCLUDE_GROUPS="${PHPUNIT_EXCLUDE_GROUPS%,}" - COMMAND=(.Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml --exclude-group ${PHPUNIT_EXCLUDE_GROUPS} "$@") + COMMAND=(.Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml --exclude-group not-${DBMS} "$@") case ${DBMS} in mariadb) echo "Using driver: ${DATABASE_DRIVER}" diff --git a/Build/phpstan-baseline-11-7.4.neon b/Build/phpstan-baseline-11-7.4.neon index 68e3a5a3..8868f0fb 100644 --- a/Build/phpstan-baseline-11-7.4.neon +++ b/Build/phpstan-baseline-11-7.4.neon @@ -71,4 +71,23 @@ parameters: - message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory not found\\.$#" count: 1 - path: ../Classes/Backend/Grid/ContainerGridColumnItem.php \ No newline at end of file + path: ../Classes/Backend/Grid/ContainerGridColumnItem.php + - + message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 4 parameters, 2 required\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext not found\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Domain\\\\Model\\\\Language\\\\PageLanguageInformation not found\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Parameter \\#1 \\$pageRecord of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects array, TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext given\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php \ No newline at end of file diff --git a/Build/phpstan-baseline-11.neon b/Build/phpstan-baseline-11.neon index 2cf5ca0c..e2d30578 100644 --- a/Build/phpstan-baseline-11.neon +++ b/Build/phpstan-baseline-11.neon @@ -81,4 +81,23 @@ parameters: - message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory not found\\.$#" count: 1 - path: ../Classes/Backend/Grid/ContainerGridColumnItem.php \ No newline at end of file + path: ../Classes/Backend/Grid/ContainerGridColumnItem.php + - + message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 4 parameters, 2 required\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext not found\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Domain\\\\Model\\\\Language\\\\PageLanguageInformation not found\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Parameter \\#1 \\$pageRecord of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects array, TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext given\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php \ No newline at end of file diff --git a/Build/phpstan-baseline-12.neon b/Build/phpstan-baseline-12.neon index e33674db..c6416d2d 100644 --- a/Build/phpstan-baseline-12.neon +++ b/Build/phpstan-baseline-12.neon @@ -81,4 +81,23 @@ parameters: - message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory not found\\.$#" count: 1 - path: ../Classes/Backend/Grid/ContainerGridColumnItem.php \ No newline at end of file + path: ../Classes/Backend/Grid/ContainerGridColumnItem.php + - + message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 4 parameters, 2 required\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext not found\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Domain\\\\Model\\\\Language\\\\PageLanguageInformation not found\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Parameter \\#1 \\$pageRecord of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects array, TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext given\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php \ No newline at end of file diff --git a/Build/phpstan-baseline-13.neon b/Build/phpstan-baseline-13.neon index c4790e6e..0ed06e3f 100644 --- a/Build/phpstan-baseline-13.neon +++ b/Build/phpstan-baseline-13.neon @@ -49,3 +49,32 @@ parameters: message: "#^Cannot call method toArray\\(\\) on array\\.$#" count: 1 path: ../Classes/Listener/PageContentPreviewRendering.php + - + message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 4 parameters, 5 required\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext not found\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Instantiated class TYPO3\\\\CMS\\\\Backend\\\\Domain\\\\Model\\\\Language\\\\PageLanguageInformation not found\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Parameter \\#1 \\$pageRecord of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects array, TYPO3\\\\CMS\\\\Backend\\\\Context\\\\PageContext given\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Parameter \\#3 \\$site of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects TYPO3\\\\CMS\\\\Core\\\\Site\\\\Entity\\\\SiteInterface, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&TYPO3\\\\CMS\\\\Backend\\\\View\\\\Drawing\\\\DrawingConfiguration given\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php + + - + message: "#^Parameter \\#4 \\$drawingConfiguration of class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor expects TYPO3\\\\CMS\\\\Backend\\\\View\\\\Drawing\\\\DrawingConfiguration, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&TYPO3\\\\CMS\\\\Core\\\\Http\\\\ServerRequest given\\.$#" + count: 1 + path: ../Tests/Functional/Integrity/IntegrityTest.php diff --git a/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php b/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php index 193dc60b..0665546a 100644 --- a/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php +++ b/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php @@ -27,13 +27,13 @@ public static function localizeKeepsSortingDataProvider(): array 4 => ['copyToLanguage' => 1], 1 => ['copyToLanguage' => 1], ], - ], 'Dataset1'], + ], 'dataset' => 'Dataset1'], ['cmdmap' => [ 'tt_content' => [ 1 => ['copyToLanguage' => 1], 4 => ['copyToLanguage' => 1], ], - ], 'Dataset2'], + ], 'dataset' => 'Dataset2'], ]; } diff --git a/Tests/Functional/Datahandler/Localization/LocalizeTest.php b/Tests/Functional/Datahandler/Localization/LocalizeTest.php index a81398bf..88429096 100644 --- a/Tests/Functional/Datahandler/Localization/LocalizeTest.php +++ b/Tests/Functional/Datahandler/Localization/LocalizeTest.php @@ -212,18 +212,24 @@ public function localizeChildKeepsRelationsIfContainerIsInConnectedMode(): void public static function localizeTwoContainerKeepsParentIndependedOnOrderDataProvider(): array { return [ - ['cmdmap' => [ - 'tt_content' => [ - 91 => ['localize' => 1], - 1 => ['localize' => 1], + [ + 'cmdmap' => [ + 'tt_content' => [ + 91 => ['localize' => 1], + 1 => ['localize' => 1], + ], ], - ], 'Dataset1'], - ['cmdmap' => [ - 'tt_content' => [ - 1 => ['localize' => 1], - 91 => ['localize' => 1], + 'dataset' => 'Dataset1', + ], + [ + 'cmdmap' => [ + 'tt_content' => [ + 1 => ['localize' => 1], + 91 => ['localize' => 1], + ], ], - ], 'Dataset2'], + 'dataset' => 'Dataset2', + ], ]; } @@ -245,18 +251,24 @@ public function localizeTwoContainerKeepsParentIndependedOnOrder(array $cmdmap, public static function localizeWithCopyTwoContainerChangeParentIndependedOnOrderDataProvider(): array { return [ - ['cmdmap' => [ - 'tt_content' => [ - 91 => ['copyToLanguage' => 1], - 1 => ['copyToLanguage' => 1], + [ + 'cmdmap' => [ + 'tt_content' => [ + 91 => ['copyToLanguage' => 1], + 1 => ['copyToLanguage' => 1], + ], ], - ], 'Dataset1'], - ['cmdmap' => [ - 'tt_content' => [ - 1 => ['copyToLanguage' => 1], - 91 => ['copyToLanguage' => 1], + 'dataset' => 'Dataset1', + ], + [ + 'cmdmap' => [ + 'tt_content' => [ + 1 => ['copyToLanguage' => 1], + 91 => ['copyToLanguage' => 1], + ], ], - ], 'Dataset2'], + 'dataset' => 'Dataset2', + ], ]; } diff --git a/Tests/Functional/Frontend/AbstractFrontend.php b/Tests/Functional/Frontend/AbstractFrontend.php index 52146a75..408d0ba2 100644 --- a/Tests/Functional/Frontend/AbstractFrontend.php +++ b/Tests/Functional/Frontend/AbstractFrontend.php @@ -11,12 +11,25 @@ */ use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Core\Cache\Backend\NullBackend; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; abstract class AbstractFrontend extends FunctionalTestCase { + protected array $configurationToUseInTestInstance = [ + 'SYS' => [ + 'caching' => [ + 'cacheConfigurations' => [ + 'fluid_template' => [ + 'backend' => NullBackend::class, + ], + ], + ], + ], + ]; + /** * @var non-empty-string[] */ diff --git a/Tests/Functional/Integrity/IntegrityTest.php b/Tests/Functional/Integrity/IntegrityTest.php index 46584a1f..b2a429bf 100644 --- a/Tests/Functional/Integrity/IntegrityTest.php +++ b/Tests/Functional/Integrity/IntegrityTest.php @@ -15,6 +15,8 @@ use B13\Container\Integrity\Error\WrongPidError; use B13\Container\Integrity\Integrity; use B13\Container\Integrity\IntegrityFix; +use TYPO3\CMS\Backend\Context\PageContext; +use TYPO3\CMS\Backend\Domain\Model\Language\PageLanguageInformation; use TYPO3\CMS\Backend\View\BackendLayout\BackendLayout; use TYPO3\CMS\Backend\View\BackendLayout\ContentFetcher; use TYPO3\CMS\Backend\View\Drawing\DrawingConfiguration; @@ -25,6 +27,7 @@ use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Site\Entity\Site; +use TYPO3\CMS\Core\Type\Bitmask\Permission; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -86,14 +89,43 @@ public function wrongPidErrorElementsAreShownAsUnusedElements(): void ->fetchAssociative(); if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 12) { $pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout); + $contentFetcher = new ContentFetcher($pageLayoutContext); + $unusedRecords = $contentFetcher->getUnusedRecords(); } else { $site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock(); $drawingConfiguration = $this->getMockBuilder(DrawingConfiguration::class)->disableOriginalConstructor()->getMock(); $serverRequest = $this->getMockBuilder(ServerRequest::class)->disableOriginalConstructor()->getMock(); - $pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout, $site, $drawingConfiguration, $serverRequest); + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 14) { + $pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout, $site, $drawingConfiguration, $serverRequest); + $contentFetcher = new ContentFetcher($pageLayoutContext); + $unusedRecords = $contentFetcher->getUnusedRecords(); + } else { + $pageLanguageInformation = new PageLanguageInformation( + $pageRecord['uid'], + [], + [], + [], + [0], + false, + [] + ); + $pageContext = new PageContext( + $pageRecord['uid'], + $pageRecord, + $site, + [], + [], + [], + $pageLanguageInformation, + new Permission() + ); + $pageLayoutContext = new PageLayoutContext($pageContext, $backendLayout, $drawingConfiguration, $serverRequest); + $container = $this->get('service_container'); + $contentFetcher = $container->get(ContentFetcher::class); + $unusedRecords = $contentFetcher->getUnusedRecords($pageLayoutContext); + } } - $contentFetcher = new ContentFetcher($pageLayoutContext); - $unusedRecords = $contentFetcher->getUnusedRecords(); + $unusedRecordsArr = []; foreach ($unusedRecords as $unusedRecord) { $unusedRecordsArr[] = $unusedRecord;