From ffc745caebd8d92b67e071ede373cc22c2b396f7 Mon Sep 17 00:00:00 2001 From: Achim Fritz Date: Wed, 11 Feb 2026 08:22:12 +0100 Subject: [PATCH] !!![TASK] drop TYPO3 v11 and v12 support --- .github/workflows/ci.yml | 23 +- Build/JavaScript/README.md | 14 - Build/JavaScript/js-12.patch | 149 -------- Build/LocalConfiguration.php | 47 --- Build/Scripts/runTests.sh | 51 +-- Build/envs/.env.local | 4 - Build/phpstan-baseline-11-7.4.neon | 93 ----- Build/phpstan-baseline-11.neon | 103 ------ Build/phpstan-baseline-12.neon | 103 ------ Build/phpstan-baseline-13.neon | 25 +- Build/phpstan-baseline-14.neon | 60 ---- Build/phpstan11-7.4.neon | 20 -- Build/phpstan11.neon | 20 -- Build/phpstan12.neon | 18 - Build/phpstan13.neon | 5 - Build/phpstan14.neon | 7 - Build/phpunit/FunctionalTests.xml | 7 +- Build/phpunit/UnitTests.xml | 5 - Build/router.php | 17 + .../RecordContextMenuItemProvider.php | 16 +- Classes/Backend/Grid/ContainerGridColumn.php | 14 +- .../Backend/Grid/ContainerGridColumnItem.php | 7 +- .../Preview/ContainerPreviewRenderer.php | 48 --- Classes/Backend/Preview/GridRenderer.php | 64 +--- .../Backend/Service/NewContentUrlBuilder.php | 17 +- ...teChildrenWithNonExistingParentCommand.php | 21 +- .../DeleteChildrenWithUnusedColPosCommand.php | 21 +- .../DeleteChildrenWithWrongPidCommand.php | 19 +- ...ContainerParentForConnectedModeCommand.php | 21 +- Classes/Command/FixLanguageModeCommand.php | 21 +- Classes/Command/IntegrityCommand.php | 15 +- Classes/Command/SortingCommand.php | 15 +- Classes/Command/SortingInPageCommand.php | 15 +- .../ContainerColumnConfigurationService.php | 25 +- .../ColumnConfigurationManipulationHook.php | 16 +- .../Xclasses/CommandMapHook.php | 19 +- .../ContentDefender/Xclasses/DatamapHook.php | 19 +- Classes/DataProcessing/ContainerProcessor.php | 21 +- Classes/Domain/Factory/ContainerFactory.php | 33 +- Classes/Domain/Factory/Database.php | 14 +- .../Factory/FrontendContainerFactory.php | 8 +- .../PageView/Backend/ContainerFactory.php | 8 +- .../PageView/Backend/ContentStorage.php | 44 +-- Classes/Domain/Model/Container.php | 53 +-- Classes/Domain/Service/ContainerService.php | 17 +- ...reContainerConfigurationIsAppliedEvent.php | 4 +- .../BeforeContainerPreviewIsRenderedEvent.php | 25 +- .../Datahandler/CommandMapAfterFinishHook.php | 10 +- .../Datahandler/CommandMapBeforeStartHook.php | 45 +-- .../CommandMapPostProcessingHook.php | 13 +- Classes/Hooks/Datahandler/Database.php | 3 +- .../Datahandler/DatamapBeforeStartHook.php | 34 +- .../DatamapPreProcessFieldArrayHook.php | 34 +- Classes/Hooks/Datahandler/DeleteHook.php | 10 +- Classes/Hooks/UsedRecords.php | 60 ---- Classes/Hooks/WizardItems.php | 52 --- Classes/Integrity/Database.php | 3 +- .../Error/ChildInTranslatedContainerError.php | 33 +- Classes/Integrity/Error/ErrorInterface.php | 6 - .../Error/NonExistingParentWarning.php | 22 +- .../Integrity/Error/UnusedColPosWarning.php | 30 +- .../Integrity/Error/WrongL18nParentError.php | 33 +- .../Integrity/Error/WrongLanguageWarning.php | 33 +- Classes/Integrity/Error/WrongParentError.php | 25 +- Classes/Integrity/Error/WrongPidError.php | 33 +- Classes/Integrity/Integrity.php | 17 +- Classes/Integrity/IntegrityFix.php | 17 +- Classes/Integrity/Sorting.php | 39 +- Classes/Integrity/SortingInPage.php | 37 +- Classes/Listener/BootCompleted.php | 13 +- Classes/Listener/ContentUsedOnPage.php | 16 +- .../LegacyPageContentPreviewRendering.php | 9 +- Classes/Listener/LegacyPageTsConfig.php | 41 --- .../ModifyNewContentElementWizardItems.php | 2 + .../Listener/PageContentPreviewRendering.php | 9 +- Classes/Listener/PageTsConfig.php | 15 +- .../Listener/RecordSummaryForLocalization.php | 15 +- .../Service/RecordLocalizeSummaryModifier.php | 11 +- Classes/Tca/ContainerConfiguration.php | 160 +-------- Classes/Tca/ItemProcFunc.php | 43 +-- Classes/Tca/Registry.php | 177 +++------ .../ContainerDeleteChildrenWithWrongPid.php | 128 ------- Classes/Updates/ContainerMigrateSorting.php | 29 +- Classes/Xclasses/LocalizationController.php | 41 --- Configuration/JavaScriptModules.php | 8 - Configuration/Services.yaml | 118 +----- README.md | 8 +- .../Partials11/PageLayout/Grid/Column.html | 84 ----- .../Private/Partials11/PageLayout/Record.html | 42 --- .../Partials12/PageLayout/Grid/Column.html | 36 -- .../PageLayout/Grid/ColumnHeader.html | 45 --- .../Private/Partials12/PageLayout/Record.html | 50 --- .../JavaScript/Overrides12/drag-drop.js | 13 - .../Public/JavaScript/Overrides12/paste.js | 13 - .../Backend/ContentDefenderCest.php | 203 +++-------- Tests/Acceptance/Backend/EditorLayoutCest.php | 13 +- Tests/Acceptance/Backend/InfoModuleCest.php | 50 --- Tests/Acceptance/Backend/LayoutCest.php | 340 ++++-------------- .../Backend/PageTsConfigModuleCest.php | 35 +- Tests/Acceptance/Backend/WorkspaceCest.php | 111 ++---- Tests/Acceptance/Support/BackendTester.php | 25 +- Tests/Acceptance/Support/PageTree.php | 108 +++++- Tests/Acceptance/Support/PageTreeV13.php | 135 ------- .../Service/NewContentUriBuilderTest.php | 13 +- .../Datahandler/AbstractDatahandler.php | 34 +- .../AbstractContentDefender.php | 11 +- .../ContentDefender/CopyContainerTest.php | 24 +- .../ContentDefender/DefaultLanguageTest.php | 54 +-- .../ContentDefender/LocalizationTest.php | 18 +- .../ContentDefender/MaxItemsTest.php | 132 +++---- .../DefaultLanguage/ContainerTest.php | 65 +--- .../CopyContainerInContainerTest.php | 5 +- .../CopyElementOtherPageTest.php | 37 +- .../DefaultLanguage/CopyElementTest.php | 41 +-- .../DefaultLanguage/CopyPageTest.php | 5 +- .../MoveElementOtherPageTest.php | 37 +- .../DefaultLanguage/MoveElementTest.php | 41 +-- .../DefaultLanguage/NewElementTest.php | 21 +- Tests/Functional/Datahandler/FixturesTest.php | 22 +- .../ConnectedMode/ContainerTest.php | 9 +- .../ConnectedMode/CopyElementTest.php | 9 +- .../MoveElementOtherPageTest.php | 25 +- .../ConnectedMode/MoveElementTest.php | 25 +- .../CopyToLanguageSortingTest.php | 27 +- ...dContainerIsSortedAfterContainerResult.csv | 10 + ...dContainerIsSortedAfterContainerResult.csv | 2 +- .../Localization/FreeMode/ContainerTest.php | 33 +- .../FreeMode/CopyElementOtherPageTest.php | 25 +- .../Localization/FreeMode/CopyElementTest.php | 25 +- .../FreeMode/MoveElementOtherPageTest.php | 25 +- .../Localization/FreeMode/MoveElementTest.php | 25 +- .../Localization/FreeMode/NewElementTest.php | 5 +- .../Datahandler/Localization/LocalizeTest.php | 77 ++-- .../Datahandler/Workspace/ContainerTest.php | 49 +-- .../PageView/Backend/ContainerFactoryTest.php | 55 +-- .../PageView/Backend/ContentStorageTest.php | 31 +- .../Functional/Frontend/AbstractFrontend.php | 13 - .../Frontend/DataProcessorWithDataTest.php | 8 +- .../Frontend/DataProcessorWithFilesTest.php | 8 +- .../Frontend/DataProcessorWithIrreTest.php | 14 +- .../Frontend/DefaultLanguageTest.php | 26 +- .../Frontend/LanguageFallbackTest.php | 38 +- .../Frontend/LanguageStrictTest.php | 32 +- .../Frontend/SiteLanguageFreeTest.php | 8 +- Tests/Functional/Frontend/WorkspaceTest.php | 44 +-- Tests/Functional/Hooks/UsedRecordsTest.php | 134 ------- Tests/Functional/Integrity/IntegrityTest.php | 84 ++--- .../Integrity/SortingInPageTest.php | 25 +- Tests/Functional/Integrity/SortingTest.php | 25 +- .../SortingWithContentDefenderTest.php | 16 +- .../Listener/ContentUsedOnPageTest.php | 40 +-- .../Listener/RecordSummaryForLocalization.php | 12 +- .../RecordLocalizeSummaryModifierTest.php | 20 +- Tests/Functional/Tca/RegistryTest.php | 75 +--- Tests/README.md | 9 +- .../DataProcessing/ContainerProcessorTest.php | 17 +- .../PageView/Backend/ContainerFactoryTest.php | 5 +- .../Domain/Service/ContainerServiceTest.php | 15 +- .../CommandMapBeforeStartHookTest.php | 25 +- .../DatamapBeforeStartHookTest.php | 5 +- Tests/Unit/Hooks/UsedRecordsTest.php | 137 ------- Tests/Unit/Listener/ContentUsedOnPageTest.php | 30 +- .../RecordLocalizeSummaryModifierTest.php | 13 +- Tests/Unit/Tca/RegistryTest.php | 9 +- composer.json | 34 +- ext_emconf.php | 2 +- ext_localconf.php | 26 -- 167 files changed, 1124 insertions(+), 4968 deletions(-) delete mode 100644 Build/JavaScript/js-12.patch delete mode 100644 Build/LocalConfiguration.php delete mode 100644 Build/envs/.env.local delete mode 100644 Build/phpstan-baseline-11-7.4.neon delete mode 100644 Build/phpstan-baseline-11.neon delete mode 100644 Build/phpstan-baseline-12.neon delete mode 100644 Build/phpstan11-7.4.neon delete mode 100644 Build/phpstan11.neon delete mode 100644 Build/phpstan12.neon create mode 100644 Build/router.php delete mode 100644 Classes/Backend/Preview/ContainerPreviewRenderer.php delete mode 100644 Classes/Hooks/UsedRecords.php delete mode 100644 Classes/Hooks/WizardItems.php delete mode 100644 Classes/Listener/LegacyPageTsConfig.php delete mode 100644 Classes/Updates/ContainerDeleteChildrenWithWrongPid.php delete mode 100644 Classes/Xclasses/LocalizationController.php delete mode 100644 Resources/Private/Partials11/PageLayout/Grid/Column.html delete mode 100644 Resources/Private/Partials11/PageLayout/Record.html delete mode 100644 Resources/Private/Partials12/PageLayout/Grid/Column.html delete mode 100644 Resources/Private/Partials12/PageLayout/Grid/ColumnHeader.html delete mode 100644 Resources/Private/Partials12/PageLayout/Record.html delete mode 100644 Resources/Public/JavaScript/Overrides12/drag-drop.js delete mode 100644 Resources/Public/JavaScript/Overrides12/paste.js delete mode 100644 Tests/Acceptance/Backend/InfoModuleCest.php delete mode 100644 Tests/Acceptance/Support/PageTreeV13.php create mode 100644 Tests/Functional/Datahandler/Localization/Fixtures/Localize/LegacyLocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv delete mode 100644 Tests/Functional/Hooks/UsedRecordsTest.php delete mode 100644 Tests/Unit/Hooks/UsedRecordsTest.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ab54624..26698323 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,17 +13,8 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - php: [ '8.1', '8.2', '8.3'] - TYPO3: [ '12' ] - include: - - TYPO3: '13' - php: '8.2' - - TYPO3: '13' - php: '8.3' - - TYPO3: '14' - php: '8.2' - - TYPO3: '14' - php: '8.3' + php: [ '8.2', '8.3', '8.4', '8.5'] + TYPO3: [ '13', '14', '14-dev' ] steps: - name: Checkout uses: actions/checkout@v4 @@ -47,19 +38,19 @@ jobs: run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s unit - name: Functional Tests - run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s functional - if: matrix.TYPO3 != '14' + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s functional -- --do-not-fail-on-deprecation + if: matrix.TYPO3 == '13' - 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' + if: matrix.TYPO3 != '13' - name: Acceptance Tests run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s acceptance -- --fail-fast - if: matrix.TYPO3 != '14' + if: matrix.TYPO3 == '13' - name: Acceptance Tests 14 run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s acceptance -- --fail-fast --skip-group=content_defender - if: matrix.TYPO3 == '14' + if: matrix.TYPO3 != '13' - name: Archive acceptance tests results uses: actions/upload-artifact@v4 if: always() diff --git a/Build/JavaScript/README.md b/Build/JavaScript/README.md index 6cf318c0..17647109 100644 --- a/Build/JavaScript/README.md +++ b/Build/JavaScript/README.md @@ -1,16 +1,4 @@ -build v12 - - git clone https://github.com/typo3/typo3.git - git checkout 12.4 - cp EXT:container/Build/JavaScript/js-12.patch . - patch -p1 < js-12.patch - cd Build - nvm use v22.2.0 - npm ci - node_modules/grunt/bin/grunt scripts - cp JavaScript/backend/layout-module/* EXT:container/Resources/Public/JavaScript/Overrides12/ - build v13 git clone https://github.com/typo3/typo3.git @@ -24,10 +12,8 @@ build v13 cp JavaScript/backend/layout-module/* EXT:container/Resources/Public/JavaScript/Overrides/ - build patch file - git format-patch 12.4 --stdout > js-12.patch git format-patch 13.4 --stdout > js-13.patch build with docker diff --git a/Build/JavaScript/js-12.patch b/Build/JavaScript/js-12.patch deleted file mode 100644 index 377f10e1..00000000 --- a/Build/JavaScript/js-12.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 03e379dd0313cea2370e580a7c937fa33c09be3b Mon Sep 17 00:00:00 2001 -From: Achim Fritz -Date: Sun, 21 Apr 2024 16:22:21 +0200 -Subject: [PATCH] js-12 - ---- - .../backend/layout-module/drag-drop.ts | 27 ++++++++++++++---- - .../TypeScript/backend/layout-module/paste.ts | 28 ++++++++++++++----- - 2 files changed, 43 insertions(+), 12 deletions(-) - -diff --git a/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts b/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts -index 897f3d390b..ee877f3094 100644 ---- a/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts -+++ b/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts -@@ -20,11 +20,11 @@ import { BaseEvent } from '@interactjs/core/BaseEvent'; - import { Interactable } from '@interactjs/core/Interactable'; - import { DragEvent } from '@interactjs/actions/drag/plugin'; - import { DropEvent } from '@interactjs/actions/drop/DropEvent'; --import DocumentService from '@typo3/core/document-service'; --import DataHandler from '../ajax-data-handler'; --import Icons from '../icons'; --import ResponseInterface from '../ajax-data-handler/response-interface'; --import RegularEvent from '@typo3/core/event/regular-event'; -+import DocumentService from '@typo3/core/document-service.js'; -+import DataHandler from '@typo3/backend/ajax-data-handler.js'; -+import Icons from '@typo3/backend/icons.js'; -+import ResponseInterface from '@typo3/backend/ajax-data-handler/response-interface.js'; -+import RegularEvent from '@typo3/core/event/regular-event.js'; - - interface Parameters { - cmd?: { [key: string]: { [key: string]: any } }; -@@ -194,6 +194,7 @@ class DragDrop { - const dropContainer = e.target as HTMLElement; - const draggedElement = e.relatedTarget as HTMLElement; - const newColumn = DragDrop.getColumnPositionForElement(dropContainer); -+ const newTxContainerParent = DragDrop.getTxContainerParentPositionForElement(dropContainer); - const contentElementUid: number = parseInt(draggedElement.dataset.uid, 10); - - if (typeof (contentElementUid) === 'number' && contentElementUid > 0) { -@@ -218,9 +219,12 @@ class DragDrop { - } - - let colPos: number | boolean = 0; -+ let txContainerParent: number = 0; - if (targetPid !== 0) { - colPos = newColumn; -+ txContainerParent = newTxContainerParent; - } -+ - const isCopyAction = (e.dragEvent.ctrlKey || dropContainer.classList.contains('t3js-paste-copy')); - const datahandlerCommand = isCopyAction ? 'copy' : 'move'; - parameters.cmd = { -@@ -232,6 +236,7 @@ class DragDrop { - update: { - colPos: colPos, - sys_language_uid: language, -+ tx_container_parent: txContainerParent, - }, - } - } -@@ -300,6 +305,18 @@ class DragDrop { - } - return false; - } -+ -+ /** -+ * @param element HTMLElement -+ * @return int -+ */ -+ private static getTxContainerParentPositionForElement(element: HTMLElement) { -+ const columnContainer = element.closest('[data-tx-container-parent]') as HTMLElement; -+ if (columnContainer !== null && columnContainer.dataset.txContainerParent !== undefined) { -+ return parseInt(columnContainer.dataset.txContainerParent, 10); -+ } -+ return 0; -+ } - } - - export default new DragDrop(); -diff --git a/Build/Sources/TypeScript/backend/layout-module/paste.ts b/Build/Sources/TypeScript/backend/layout-module/paste.ts -index b692c62c84..74a96a8d0f 100644 ---- a/Build/Sources/TypeScript/backend/layout-module/paste.ts -+++ b/Build/Sources/TypeScript/backend/layout-module/paste.ts -@@ -11,7 +11,7 @@ - * The TYPO3 project - inspiring people to share! - */ - --import DocumentService from '@typo3/core/document-service'; -+import DocumentService from '@typo3/core/document-service.js'; - /** - * Module: @typo3/backend/layout-module/paste - * Dynamically adds "Paste" Icons in the Page Layout module (Web => Page) -@@ -19,12 +19,12 @@ import DocumentService from '@typo3/core/document-service'; - * to execute the action to paste the current clipboard contents. - */ - import $ from 'jquery'; --import ResponseInterface from '../ajax-data-handler/response-interface'; --import DataHandler from '../ajax-data-handler'; --import { default as Modal, ModalElement, Button } from '@typo3/backend/modal'; --import Severity from '../severity'; --import '@typo3/backend/element/icon-element'; --import { SeverityEnum } from '../enum/severity'; -+import ResponseInterface from '@typo3/backend/ajax-data-handler/response-interface.js'; -+import DataHandler from '@typo3/backend/ajax-data-handler.js'; -+import { default as Modal, ModalElement, Button } from '@typo3/backend/modal.js'; -+import Severity from '@typo3/backend/severity.js'; -+import '@typo3/backend/element/icon-element.js'; -+import { SeverityEnum } from '@typo3/backend/enum/severity.js'; - - type PasteOptions = { - itemOnClipboardUid: number; -@@ -70,6 +70,18 @@ class Paste { - return 0; - } - -+ /** -+ * @param {JQuery} $element -+ * @return number -+ */ -+ private static determineTxContainerParent($element: JQuery): number { -+ const $columnContainer = $element.closest('[data-tx-container-parent]'); -+ if ($columnContainer.length && $columnContainer.data('txContainerParent') !== 'undefined') { -+ return $columnContainer.data('txContainerParent'); -+ } -+ return 0; -+ } -+ - private initializeEvents(): void - { - $(document).on('click', '.t3js-paste', (evt: Event): void => { -@@ -144,6 +156,7 @@ class Paste { - */ - private execute($element: JQuery): void { - const colPos = Paste.determineColumn($element); -+ const txContainerParent = Paste.determineTxContainerParent($element); - const closestElement = $element.closest(this.elementIdentifier); - const targetFound = closestElement.data('uid'); - let targetPid; -@@ -160,6 +173,7 @@ class Paste { - update: { - colPos: colPos, - sys_language_uid: language, -+ tx_container_parent: txContainerParent, - }, - }, - }; --- -2.39.2 (Apple Git-143) - diff --git a/Build/LocalConfiguration.php b/Build/LocalConfiguration.php deleted file mode 100644 index ac3e65d3..00000000 --- a/Build/LocalConfiguration.php +++ /dev/null @@ -1,47 +0,0 @@ - [ - 'debug' => true, - 'defaultUC' => [ - 'startModule' => 'help_AboutAbout', - ], - ], - 'DB' => [ - 'Connections' => [ - 'Default' => [ - 'charset' => 'utf8mb4', - 'dbname' => getenv('typo3DatabaseName') . '_at', - 'driver' => 'mysqli', - 'host' => getenv('typo3DatabaseHost'), - 'password' => getenv('typo3DatabasePassword'), - 'port' => 3306, - 'tableoptions' => [ - 'charset' => 'utf8mb4', - 'collate' => 'utf8mb4_unicode_ci', - ], - 'user' => getenv('typo3DatabaseUsername'), - ], - ], - ], - 'EXTENSIONS' => [ - 'backend' => [ - 'backendFavicon' => '', - 'backendLogo' => '', - 'loginBackgroundImage' => '', - 'loginFootnote' => '', - 'loginHighlightColor' => '', - 'loginLogo' => '', - ], - 'extensionmanager' => [ - 'automaticInstallation' => '1', - 'offlineMode' => '0', - ], - ], - 'SYS' => [ - 'encryptionKey' => 'ce65db146ca7894aa19d832a8435ae2cc7db13259d7424c3efeb428e2eae6566d97712bb79a9272c6b32569882356c22', - 'sitename' => 'container-tests', - 'trustedHostsPattern' => '.*.*', - ], -]; diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 75e0cf92..6191c016 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -142,21 +142,18 @@ Options: - podman (default) - docker - -p <7.4|8.0|8.1|8.2|8.3|8.4> + -p <8.2|8.3|8.4|8.5> Specifies the PHP minor version to be used - - 7.4: use PHP 7.4 - - 8.0: use PHP 8.0 - - 8.1: use PHP 8.1 - 8.2 (default): use PHP 8.2 - 8.3: use PHP 8.3 - 8.4: use PHP 8.4 + - 8.5: use PHP 8.5 - -t <11|12|13|14> + -t <13|14|14-dev> Specifies the TYPO3 Core version to be used - Only with -s composerInstall|phpstan|acceptance - - 11: Use TYPO3 v11.5 - - 12 (default): Use TYPO3 v12.4 - 13: Use TYPO3 v13.x - 14: Use TYPO3 v14.x + - 14-dev Use TYPO3 14.2.x-dev -a Only with -s functional|functionalDeprecated @@ -338,16 +335,17 @@ while getopts "a:b:s:d:i:t:p:xy:o:nhug" OPT; do ;; t) TYPO3=${OPTARG} - if ! [[ ${TYPO3} =~ ^(11|12|13|14)$ ]]; then + if ! [[ ${TYPO3} =~ ^(13|14|14-dev)$ ]]; then INVALID_OPTIONS+=("${OPTARG}") fi # @todo Remove USE_APACHE option when TF7 has been dropped (along with TYPO3 v11 support). [[ "${TYPO3}" -eq 13 ]] && USE_APACHE=1 [[ "${TYPO3}" -eq 14 ]] && USE_APACHE=1 + [[ "${TYPO3}" -eq "14-dev" ]] && USE_APACHE=1 ;; p) PHP_VERSION=${OPTARG} - if ! [[ ${PHP_VERSION} =~ ^(7.4|8.0|8.1|8.2|8.3|8.4)$ ]]; then + if ! [[ ${PHP_VERSION} =~ ^(8.2|8.3|8.4|8.5)$ ]]; then INVALID_OPTIONS+=("${OPTARG}") fi ;; @@ -597,18 +595,13 @@ case ${TEST_SUITE} in fi ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-install-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/sh -c " php -v | grep '^PHP'; - if [ ${TYPO3} -eq 11 ]; then - composer require typo3/cms-core:^11.5 ichhabrecht/content-defender --dev -W --no-progress --no-interaction - composer prepare-tests - elif [ ${TYPO3} -eq 13 ]; then - composer require typo3/cms-core:^13.4 typo3/testing-framework:^9 phpunit/phpunit:^11 ichhabrecht/content-defender --dev -W --no-progress --no-interaction - composer prepare-tests + + if [ "${TYPO3}" == "14-dev" ]; then + composer require typo3/cms-core:14.2.x-dev --dev -W --no-progress --no-interaction elif [ ${TYPO3} -eq 14 ]; then - composer require typo3/cms-core:^14.0 --dev -W --no-progress --no-interaction - composer prepare-tests + composer require typo3/cms-core:^14.1 --dev -W --no-progress --no-interaction else - composer require typo3/cms-core:^12.4 typo3/testing-framework:^8.2 phpunit/phpunit:^10.5 ichhabrecht/content-defender --dev -W --no-progress --no-interaction - composer prepare-tests + composer require typo3/cms-core:^13.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction fi " SUITE_EXIT_CODE=$? @@ -622,18 +615,12 @@ case ${TEST_SUITE} in fi ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-validate-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/sh -c " php -v | grep '^PHP'; - if [ ${TYPO3} -eq 11 ]; then - composer require typo3/cms-core:^11.5 ichhabrecht/content-defender --dev -W --no-progress --no-interaction - composer prepare-tests + if [ "${TYPO3}" == "14-dev" ]; then + composer require typo3/cms-core:14.2.x-dev --dev -W --no-progress --no-interaction elif [ ${TYPO3} -eq 14 ]; then - composer require typo3/cms-core:^14.0 --dev -W --no-progress --no-interaction - composer prepare-tests - elif [ ${TYPO3} -eq 13 ]; then - composer require typo3/cms-core:^13.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction - composer prepare-tests + composer require typo3/cms-core:^14.1 --dev -W --no-progress --no-interaction else - composer require typo3/cms-core:^12.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction - composer prepare-tests + composer require typo3/cms-core:^13.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction fi composer validate " @@ -688,10 +675,10 @@ case ${TEST_SUITE} in SUITE_EXIT_CODE=$? ;; phpstan) - if [ ${PHP_VERSION} == "7.4" ]; then - COMMAND=(php -dxdebug.mode=off .Build/bin/phpstan analyse -c Build/phpstan${TYPO3}-7.4.neon --no-progress --no-interaction --memory-limit 4G "$@") + if [ ${TYPO3} == 13 ]; then + COMMAND=(php -dxdebug.mode=off .Build/bin/phpstan analyse -c Build/phpstan13.neon --no-progress --no-interaction --memory-limit 4G "$@") else - COMMAND=(php -dxdebug.mode=off .Build/bin/phpstan analyse -c Build/phpstan${TYPO3}.neon --no-progress --no-interaction --memory-limit 4G "$@") + COMMAND=(php -dxdebug.mode=off .Build/bin/phpstan analyse -c Build/phpstan14.neon --no-progress --no-interaction --memory-limit 4G "$@") fi ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name phpstan-${SUFFIX} ${IMAGE_PHP} "${COMMAND[@]}" SUITE_EXIT_CODE=$? diff --git a/Build/envs/.env.local b/Build/envs/.env.local deleted file mode 100644 index c89cd37d..00000000 --- a/Build/envs/.env.local +++ /dev/null @@ -1,4 +0,0 @@ -typo3DatabaseName=foox -typo3DatabaseUsername=dev -typo3DatabasePassword=dev -typo3DatabaseHost=127.0.0.1 diff --git a/Build/phpstan-baseline-11-7.4.neon b/Build/phpstan-baseline-11-7.4.neon deleted file mode 100644 index 8868f0fb..00000000 --- a/Build/phpstan-baseline-11-7.4.neon +++ /dev/null @@ -1,93 +0,0 @@ -parameters: - ignoreErrors: - - - - message: "#^Constant LF not found\\.$#" - count: 5 - path: ../Classes/Tca/Registry.php - - - - message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 679$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 743$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ConfigurationException is not subtype of Throwable$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ModuleException is not subtype of Throwable$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#" - count: 1 - path: ../Tests/Acceptance/Support/PageTree.php - - - - message: "#^Constant ORIGINAL_ROOT not found\\.$#" - count: 1 - path: ../Tests/Functional/Datahandler/AbstractDatahandler.php - - - - message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 5 parameters, 2 required\\.$#" - count: 1 - path: ../Tests/Functional/Integrity/IntegrityTest.php - - - message: "#^Class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface not found\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Instantiated class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryData not found\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#" - count: 1 - path: ../Classes/Domain/Factory/ContainerFactory.php - - - - message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#" - count: 2 - path: ../Classes/Domain/Factory/PageView/Backend/ContentStorage.php - - - message: "#^Cannot call method getRecordType\\(\\) on array\\.$#" - count: 1 - path: ../Classes/Listener/PageContentPreviewRendering.php - - - - message: "#^Cannot call method toArray\\(\\) on array\\.$#" - count: 1 - path: ../Classes/Listener/PageContentPreviewRendering.php - - - message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory not found\\.$#" - count: 1 - 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 deleted file mode 100644 index e2d30578..00000000 --- a/Build/phpstan-baseline-11.neon +++ /dev/null @@ -1,103 +0,0 @@ -parameters: - ignoreErrors: - - - - message: "#^Constant LF not found\\.$#" - count: 5 - path: ../Classes/Tca/Registry.php - - - - message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 679$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 743$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ConfigurationException is not subtype of Throwable$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ModuleException is not subtype of Throwable$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#" - count: 1 - path: ../Tests/Acceptance/Support/PageTree.php - - - - message: "#^Constant ORIGINAL_ROOT not found\\.$#" - count: 1 - path: ../Tests/Functional/Datahandler/AbstractDatahandler.php - - - - message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 5 parameters, 2 required\\.$#" - count: 1 - path: ../Tests/Functional/Integrity/IntegrityTest.php - - - message: "#^Attribute class TYPO3\\\\CMS\\\\Install\\\\Attribute\\\\UpgradeWizard does not exist\\.$#" - count: 1 - path: ../Classes/Updates/ContainerDeleteChildrenWithWrongPid.php - - - - message: "#^Attribute class TYPO3\\\\CMS\\\\Install\\\\Attribute\\\\UpgradeWizard does not exist\\.$#" - count: 1 - path: ../Classes/Updates/ContainerMigrateSorting.php - - - - message: "#^Class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface not found\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Instantiated class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryData not found\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#" - count: 1 - path: ../Classes/Domain/Factory/ContainerFactory.php - - - - message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#" - count: 2 - path: ../Classes/Domain/Factory/PageView/Backend/ContentStorage.php - - - message: "#^Cannot call method getRecordType\\(\\) on array\\.$#" - count: 1 - path: ../Classes/Listener/PageContentPreviewRendering.php - - - - message: "#^Cannot call method toArray\\(\\) on array\\.$#" - count: 1 - path: ../Classes/Listener/PageContentPreviewRendering.php - - - message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory not found\\.$#" - count: 1 - 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 deleted file mode 100644 index 704bb8dd..00000000 --- a/Build/phpstan-baseline-12.neon +++ /dev/null @@ -1,103 +0,0 @@ -parameters: - ignoreErrors: - - - - message: "#^Constant LF not found\\.$#" - count: 5 - path: ../Classes/Tca/Registry.php - - - - message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 679$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 743$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ConfigurationException is not subtype of Throwable$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ModuleException is not subtype of Throwable$#" - count: 1 - path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#" - count: 1 - path: ../Tests/Acceptance/Support/PageTree.php - - - - message: "#^Constant ORIGINAL_ROOT not found\\.$#" - count: 1 - path: ../Tests/Functional/Datahandler/AbstractDatahandler.php - - - - message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 5 parameters, 2 required\\.$#" - count: 1 - path: ../Tests/Functional/Integrity/IntegrityTest.php - - - message: "#^Call to method create\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface not found\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Instantiated class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryData not found\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#" - count: 1 - path: ../Classes/Domain/Factory/ContainerFactory.php - - - - message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#" - count: 2 - path: ../Classes/Domain/Factory/PageView/Backend/ContentStorage.php - - - message: "#^Cannot call method getRecordType\\(\\) on array\\.$#" - count: 1 - path: ../Classes/Listener/PageContentPreviewRendering.php - - - - message: "#^Cannot call method toArray\\(\\) on array\\.$#" - count: 1 - path: ../Classes/Listener/PageContentPreviewRendering.php - - - message: "#^Call to method createResolvedRecordFromDatabaseRow\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory\\.$#" - count: 1 - path: ../Classes/Backend/Grid/ContainerGridColumnItem.php - - - - message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordFactory not found\\.$#" - count: 1 - 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 0ed06e3f..07678c3e 100644 --- a/Build/phpstan-baseline-13.neon +++ b/Build/phpstan-baseline-13.neon @@ -1,11 +1,5 @@ parameters: ignoreErrors: - - - - message: "#^Constant LF not found\\.$#" - count: 5 - path: ../Classes/Tca/Registry.php - - message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 679$#" count: 1 @@ -25,21 +19,6 @@ parameters: message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ModuleException is not subtype of Throwable$#" count: 1 path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#" - count: 1 - path: ../Tests/Acceptance/Support/PageTree.php - - - - message: "#^Constant ORIGINAL_ROOT not found\\.$#" - count: 1 - path: ../Tests/Functional/Datahandler/AbstractDatahandler.php - - - - message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 2 parameters, 5 required\\.$#" - count: 1 - path: ../Tests/Functional/Integrity/IntegrityTest.php - message: "#^Cannot call method getRecordType\\(\\) on array\\.$#" count: 1 @@ -78,3 +57,7 @@ parameters: 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 + - + message: "#^Access to an undefined property B13\\\\Container\\\\Backend\\\\ContextMenu\\\\RecordContextMenuItemProvider\\:\\:\\$uriBuilder\\.$#" + count: 1 + path: ../Classes/Backend/ContextMenu/RecordContextMenuItemProvider.php diff --git a/Build/phpstan-baseline-14.neon b/Build/phpstan-baseline-14.neon index 66974b6b..b048f1a4 100644 --- a/Build/phpstan-baseline-14.neon +++ b/Build/phpstan-baseline-14.neon @@ -1,11 +1,5 @@ parameters: ignoreErrors: - - - - message: "#^Constant LF not found\\.$#" - count: 5 - path: ../Classes/Tca/Registry.php - - message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 679$#" count: 1 @@ -25,61 +19,7 @@ parameters: message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ModuleException is not subtype of Throwable$#" count: 1 path: ../Tests/Acceptance/Support/BackendTester.php - - - - message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#" - count: 1 - path: ../Tests/Acceptance/Support/PageTree.php - - - - message: "#^Constant ORIGINAL_ROOT not found\\.$#" - count: 1 - path: ../Tests/Functional/Datahandler/AbstractDatahandler.php - - message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 2 parameters, 5 required\\.$#" count: 1 path: ../Tests/Functional/Integrity/IntegrityTest.php - - - message: "#^Call to method assign\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#" - count: 9 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Call to method render\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Call to method setLayoutRootPaths\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Call to method setPartialRootPaths\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Call to method setTemplatePathAndFilename\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView not found\\.$#" - count: 1 - path: ../Classes/Backend/Preview/GridRenderer.php - - - - message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:cast\\(\\)\\.$#" - count: 1 - path: ../Classes/Domain/Factory/ContainerFactory.php - - - - message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:cast\\(\\)\\.$#" - count: 2 - path: ../Classes/Domain/Factory/PageView/Backend/ContentStorage.php - - - message: "#^Parameter \\#1 \\$record of method B13\\\\Container\\\\Backend\\\\Preview\\\\GridRenderer\\:\\:renderGrid\\(\\) expects array, TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface given\\.$#" - count: 1 - path: ../Classes/Backend/Preview/ContainerPreviewRenderer.php diff --git a/Build/phpstan11-7.4.neon b/Build/phpstan11-7.4.neon deleted file mode 100644 index 100d9fed..00000000 --- a/Build/phpstan11-7.4.neon +++ /dev/null @@ -1,20 +0,0 @@ -includes: - - phpstan-baseline-11-7.4.neon - -parameters: - level: 5 - - paths: - - %currentWorkingDirectory%/Classes - - %currentWorkingDirectory%/Tests - - excludePaths: - - %currentWorkingDirectory%/Classes/Listener/ModifyNewContentElementWizardItems.php - - %currentWorkingDirectory%/Classes/Listener/ContentUsedOnPage.php - - %currentWorkingDirectory%/Tests/Unit/Listener/ContentUsedOnPageTest.php - - %currentWorkingDirectory%/Tests/Functional/Listener/ContentUsedOnPageTest.php - - %currentWorkingDirectory%/Classes/Listener/RecordSummaryForLocalization.php - - %currentWorkingDirectory%/Classes/Listener/PageTsConfig.php - - %currentWorkingDirectory%/Classes/Listener/PageContentPreviewRendering.php - - %currentWorkingDirectory%/Classes/Domain/Core/RecordWithRenderedGrid.php - diff --git a/Build/phpstan11.neon b/Build/phpstan11.neon deleted file mode 100644 index d8abcf8e..00000000 --- a/Build/phpstan11.neon +++ /dev/null @@ -1,20 +0,0 @@ -includes: - - phpstan-baseline-11.neon - -parameters: - level: 5 - - paths: - - %currentWorkingDirectory%/Classes - - %currentWorkingDirectory%/Tests - - excludePaths: - - %currentWorkingDirectory%/Classes/Listener/ModifyNewContentElementWizardItems.php - - %currentWorkingDirectory%/Classes/Listener/ContentUsedOnPage.php - - %currentWorkingDirectory%/Tests/Unit/Listener/ContentUsedOnPageTest.php - - %currentWorkingDirectory%/Tests/Functional/Listener/ContentUsedOnPageTest.php - - %currentWorkingDirectory%/Classes/Listener/RecordSummaryForLocalization.php - - %currentWorkingDirectory%/Classes/Listener/PageTsConfig.php - - %currentWorkingDirectory%/Classes/Listener/PageContentPreviewRendering.php - - %currentWorkingDirectory%/Classes/Domain/Core/RecordWithRenderedGrid.php - diff --git a/Build/phpstan12.neon b/Build/phpstan12.neon deleted file mode 100644 index 31ff873e..00000000 --- a/Build/phpstan12.neon +++ /dev/null @@ -1,18 +0,0 @@ -includes: - - phpstan-baseline-12.neon - -parameters: - level: 5 - - paths: - - %currentWorkingDirectory%/Classes - - %currentWorkingDirectory%/Tests - - excludePaths: - - %currentWorkingDirectory%/Classes/Hooks/UsedRecords.php - - %currentWorkingDirectory%/Tests/Functional/Hooks/UsedRecordsTest.php - - %currentWorkingDirectory%/Tests/Unit/Hooks/UsedRecordsTest.php - - %currentWorkingDirectory%/Classes/Domain/Core/RecordWithRenderedGrid.php - - %currentWorkingDirectory%/Classes/Listener/PageContentPreviewRendering.php - - diff --git a/Build/phpstan13.neon b/Build/phpstan13.neon index 0e3bc701..e254f305 100644 --- a/Build/phpstan13.neon +++ b/Build/phpstan13.neon @@ -9,10 +9,5 @@ parameters: - %currentWorkingDirectory%/Tests excludePaths: - - %currentWorkingDirectory%/Classes/Hooks/UsedRecords.php - - %currentWorkingDirectory%/Tests/Functional/Hooks/UsedRecordsTest.php - - %currentWorkingDirectory%/Tests/Unit/Hooks/UsedRecordsTest.php - - %currentWorkingDirectory%/Classes/Hooks/WizardItems.php - - %currentWorkingDirectory%/Classes/Listener/LegacyPageTsConfig.php - %currentWorkingDirectory%/Classes/Listener/PageContentPreviewRendering.php diff --git a/Build/phpstan14.neon b/Build/phpstan14.neon index b1337d0c..f003d8c4 100644 --- a/Build/phpstan14.neon +++ b/Build/phpstan14.neon @@ -9,14 +9,7 @@ parameters: - %currentWorkingDirectory%/Tests excludePaths: - - %currentWorkingDirectory%/Classes/Hooks/UsedRecords.php - - %currentWorkingDirectory%/Tests/Functional/Hooks/UsedRecordsTest.php - - %currentWorkingDirectory%/Tests/Unit/Hooks/UsedRecordsTest.php - - %currentWorkingDirectory%/Classes/Hooks/WizardItems.php - - %currentWorkingDirectory%/Classes/Listener/LegacyPageTsConfig.php - %currentWorkingDirectory%/Classes/Listener/LegacyPageContentPreviewRendering.php - %currentWorkingDirectory%/Classes/ContentDefender - - %currentWorkingDirectory%/Classes/Events/BeforeContainerPreviewIsRenderedEvent.php - %currentWorkingDirectory%/Tests/Functional/Integrity/IntegrityTest.php - - %currentWorkingDirectory%/Classes/Xclasses/LocalizationController.php diff --git a/Build/phpunit/FunctionalTests.xml b/Build/phpunit/FunctionalTests.xml index 438bc7ff..79f6e2e7 100644 --- a/Build/phpunit/FunctionalTests.xml +++ b/Build/phpunit/FunctionalTests.xml @@ -4,17 +4,13 @@ backupGlobals="true" bootstrap="FunctionalTestsBootstrap.php" colors="true" - convertErrorsToExceptions="true" - convertWarningsToExceptions="true" - convertDeprecationsToExceptions="false" - forceCoversAnnotation="false" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" - verbose="false" beStrictAboutTestsThatDoNotTestAnything="false" failOnWarning="true" + failOnDeprecation="true" > @@ -22,7 +18,6 @@ - diff --git a/Build/phpunit/UnitTests.xml b/Build/phpunit/UnitTests.xml index c0caedb4..30215c62 100644 --- a/Build/phpunit/UnitTests.xml +++ b/Build/phpunit/UnitTests.xml @@ -4,16 +4,11 @@ backupGlobals="true" bootstrap="UnitTestsBootstrap.php" colors="true" - convertErrorsToExceptions="true" - convertWarningsToExceptions="true" - convertNoticesToExceptions="true" - forceCoversAnnotation="false" processIsolation="false" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" - verbose="false" beStrictAboutTestsThatDoNotTestAnything="false" failOnWarning="true" > diff --git a/Build/router.php b/Build/router.php new file mode 100644 index 00000000..ecb268c5 --- /dev/null +++ b/Build/router.php @@ -0,0 +1,17 @@ +has(\TYPO3\CMS\Core\Http\Application::class)) { + $container->get(\TYPO3\CMS\Core\Http\Application::class)->run(); + return; + } + $container->get(\TYPO3\CMS\Install\Http\Application::class)->run(); +} +return false; diff --git a/Classes/Backend/ContextMenu/RecordContextMenuItemProvider.php b/Classes/Backend/ContextMenu/RecordContextMenuItemProvider.php index 67042c6d..38a8288e 100644 --- a/Classes/Backend/ContextMenu/RecordContextMenuItemProvider.php +++ b/Classes/Backend/ContextMenu/RecordContextMenuItemProvider.php @@ -5,24 +5,20 @@ namespace B13\Container\Backend\ContextMenu; use TYPO3\CMS\Backend\Routing\UriBuilder; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; class RecordContextMenuItemProvider extends \TYPO3\CMS\Backend\ContextMenu\ItemProviders\RecordProvider { /** * Add tx_container_parent to newContentElementWizard Url if it is a tt_content record in a container - * - * @param string $itemName - * - * @return array - * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException */ protected function getAdditionalAttributes(string $itemName): array { $attributes = parent::getAdditionalAttributes($itemName); if ($itemName === 'newWizard' && $this->table === 'tt_content' && isset($this->record['tx_container_parent']) && $this->record['tx_container_parent'] > 0) { - $languageField = method_exists($this, 'getLanguageField') ? $this->getLanguageField() : $GLOBALS['TCA']['tt_content']['ctrl']['languageField']; + $languageField = $this->getLanguageField(); $urlParameters = [ 'id' => $this->record['pid'], 'sys_language_uid' => $this->record[$languageField] ?? null, @@ -30,8 +26,12 @@ protected function getAdditionalAttributes(string $itemName): array 'uid_pid' => -$this->record['uid'], 'tx_container_parent' => $this->record['tx_container_parent'], ]; - $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); - $url = (string)$uriBuilder->buildUriFromRoute('new_content_element_wizard', $urlParameters); + if ((new Typo3Version())->getMajorVersion() < 14) { + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $url = (string)$uriBuilder->buildUriFromRoute('new_content_element_wizard', $urlParameters); + } else { + $url = (string)$this->uriBuilder->buildUriFromRoute('new_content_element_wizard', $urlParameters); + } if (isset($attributes['data-new-wizard-url'])) { $attributes['data-new-wizard-url'] = $url; } diff --git a/Classes/Backend/Grid/ContainerGridColumn.php b/Classes/Backend/Grid/ContainerGridColumn.php index 46cb0f87..a3cfc1fa 100644 --- a/Classes/Backend/Grid/ContainerGridColumn.php +++ b/Classes/Backend/Grid/ContainerGridColumn.php @@ -20,22 +20,14 @@ class ContainerGridColumn extends GridColumn { public const CONTAINER_COL_POS_DELIMITER = '-'; - protected $container; - - protected ?string $newContentUrl = null; - protected bool $skipNewContentElementWizard; - public function __construct( PageLayoutContext $context, array $columnDefinition, - Container $container, - ?string $newContentUrl, - bool $skipNewContentElementWizard + protected Container $container, + protected ?string $newContentUrl, + protected bool $skipNewContentElementWizard ) { parent::__construct($context, $columnDefinition); - $this->container = $container; - $this->newContentUrl = $newContentUrl; - $this->skipNewContentElementWizard = $skipNewContentElementWizard; } public function getContainerUid(): int diff --git a/Classes/Backend/Grid/ContainerGridColumnItem.php b/Classes/Backend/Grid/ContainerGridColumnItem.php index cdbfbed0..60d22e71 100644 --- a/Classes/Backend/Grid/ContainerGridColumnItem.php +++ b/Classes/Backend/Grid/ContainerGridColumnItem.php @@ -21,18 +21,13 @@ class ContainerGridColumnItem extends GridColumnItem { - protected $container; - protected ?string $newContentUrl = null; - - public function __construct(PageLayoutContext $context, ContainerGridColumn $column, array $record, Container $container, ?string $newContentUrl) + public function __construct(PageLayoutContext $context, ContainerGridColumn $column, array $record, protected Container $container, protected ?string $newContentUrl) { if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 13) { $recordFactory = GeneralUtility::makeInstance(RecordFactory::class); $record = $recordFactory->createResolvedRecordFromDatabaseRow('tt_content', $record); } parent::__construct($context, $column, $record); - $this->container = $container; - $this->newContentUrl = $newContentUrl; } public function getAllowNewContent(): bool diff --git a/Classes/Backend/Preview/ContainerPreviewRenderer.php b/Classes/Backend/Preview/ContainerPreviewRenderer.php deleted file mode 100644 index 7232ec1d..00000000 --- a/Classes/Backend/Preview/ContainerPreviewRenderer.php +++ /dev/null @@ -1,48 +0,0 @@ -gridRenderer = $gridRenderer; - $this->runtimeCache = $runtimeCache; - } - - public function renderPageModulePreviewHeader(GridColumnItem $item): string - { - $this->runtimeCache->set('tx_container_current_gridColumItem', $item); - return parent::renderPageModulePreviewHeader($item); - } - - public function renderPageModulePreviewContent(GridColumnItem $item): string - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 11) { - return parent::renderPageModulePreviewContent($item); - } - $record = $item->getRecord(); - $record['tx_container_grid'] = $this->gridRenderer->renderGrid($record, $item->getContext()); - $item->setRecord($record); - return parent::renderPageModulePreviewContent($item); - } -} diff --git a/Classes/Backend/Preview/GridRenderer.php b/Classes/Backend/Preview/GridRenderer.php index 12fa68e5..1107bd6b 100644 --- a/Classes/Backend/Preview/GridRenderer.php +++ b/Classes/Backend/Preview/GridRenderer.php @@ -25,34 +25,20 @@ use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridRow; use TYPO3\CMS\Backend\View\PageLayoutContext; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\View\ViewFactoryData; use TYPO3\CMS\Core\View\ViewFactoryInterface; -use TYPO3\CMS\Fluid\View\StandaloneView; class GridRenderer { - protected Registry $tcaRegistry; - protected ContainerFactory $containerFactory; - protected NewContentUrlBuilder $newContentUrlBuilder; - protected EventDispatcherInterface $eventDispatcher; - protected FrontendInterface $runtimeCache; - public function __construct( - Registry $tcaRegistry, - ContainerFactory $containerFactory, - NewContentUrlBuilder $newContentUrlBuilder, - EventDispatcherInterface $eventDispatcher, - FrontendInterface $runtimeCache + protected Registry $tcaRegistry, + protected ContainerFactory $containerFactory, + protected NewContentUrlBuilder $newContentUrlBuilder, + protected EventDispatcherInterface $eventDispatcher, + protected ViewFactoryInterface $viewFactory ) { - $this->eventDispatcher = $eventDispatcher; - $this->tcaRegistry = $tcaRegistry; - $this->containerFactory = $containerFactory; - $this->newContentUrlBuilder = $newContentUrlBuilder; - $this->runtimeCache = $runtimeCache; } public function renderGrid(array $record, PageLayoutContext $context): string @@ -87,20 +73,12 @@ public function renderGrid(array $record, PageLayoutContext $context): string $gridTemplate = $this->tcaRegistry->getGridTemplate($record['CType']); $partialRootPaths = $this->tcaRegistry->getGridPartialPaths($record['CType']); $layoutRootPaths = $this->tcaRegistry->getGridLayoutPaths($record['CType']); - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() <= 13) { - $view = GeneralUtility::makeInstance(StandaloneView::class); - $view->setPartialRootPaths($partialRootPaths); - $view->setLayoutRootPaths($layoutRootPaths); - $view->setTemplatePathAndFilename($gridTemplate); - } else { - $viewFactory = GeneralUtility::makeInstance(ViewFactoryInterface::class); - $view = $viewFactory->create(new ViewFactoryData( - null, - $partialRootPaths, - $layoutRootPaths, - $gridTemplate - )); - } + $view = $this->viewFactory->create(new ViewFactoryData( + null, + $partialRootPaths, + $layoutRootPaths, + $gridTemplate + )); $view->assign('hideRestrictedColumns', (bool)(BackendUtility::getPagesTSconfig($context->getPageId())['mod.']['web_layout.']['hideRestrictedCols'] ?? false)); $view->assign('newContentTitle', $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newContentElement')); @@ -112,29 +90,17 @@ public function renderGrid(array $record, PageLayoutContext $context): string $view->assign('gridColumns', array_fill(1, $grid->getSpan(), null)); $view->assign('containerRecord', $record); $view->assign('context', $context); - $parentGridColumnItem = $this->runtimeCache->get('tx_container_current_gridColumItem'); - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() <= 13) { - // cannot be used for v14 / dev-main branch - // needs adaption in next major version - $beforeContainerPreviewIsRendered = new BeforeContainerPreviewIsRenderedEvent($container, $view, $grid, $parentGridColumnItem); - $this->eventDispatcher->dispatch($beforeContainerPreviewIsRendered); - } + $beforeContainerPreviewIsRendered = new BeforeContainerPreviewIsRenderedEvent($container, $view, $grid); + $this->eventDispatcher->dispatch($beforeContainerPreviewIsRendered); $rendered = $view->render(); return $rendered; } protected function getDefValsForContentDefenderAllowsOnlyOneSpecificContentType(string $cType, int $colPos): ?array { - $contentDefefenderConfiguration = $this->tcaRegistry->getContentDefenderConfiguration($cType, $colPos); - $allowedCTypes = GeneralUtility::trimExplode(',', $contentDefefenderConfiguration['allowed.']['CType'] ?? '', true); - $allowedListTypes = GeneralUtility::trimExplode(',', $contentDefefenderConfiguration['allowed.']['list_type'] ?? '', true); + $allowedCTypes = (array)$this->tcaRegistry->getAllowedCTypesInColumn($cType, $colPos); if (count($allowedCTypes) === 1) { - if ($allowedCTypes[0] !== 'list') { - return ['CType' => $allowedCTypes[0]]; - } - if (count($allowedListTypes) === 1) { - return ['CType' => 'list', 'list_type' => $allowedListTypes[0]]; - } + return ['CType' => $allowedCTypes[0]]; } return null; } diff --git a/Classes/Backend/Service/NewContentUrlBuilder.php b/Classes/Backend/Service/NewContentUrlBuilder.php index dac72631..37bb47b4 100644 --- a/Classes/Backend/Service/NewContentUrlBuilder.php +++ b/Classes/Backend/Service/NewContentUrlBuilder.php @@ -22,21 +22,12 @@ class NewContentUrlBuilder { - protected Registry $tcaRegistry; - protected ContainerColumnConfigurationService $containerColumnConfigurationService; - protected ContainerService $containerService; - protected UriBuilder $uriBuilder; - public function __construct( - Registry $tcaRegistry, - ContainerColumnConfigurationService $containerColumnConfigurationService, - ContainerService $containerService, - UriBuilder $uriBuilder + protected Registry $tcaRegistry, + protected ContainerColumnConfigurationService $containerColumnConfigurationService, + protected ContainerService $containerService, + protected UriBuilder $uriBuilder ) { - $this->tcaRegistry = $tcaRegistry; - $this->containerColumnConfigurationService = $containerColumnConfigurationService; - $this->containerService = $containerService; - $this->uriBuilder = $uriBuilder; } public function getNewContentUrlAfterChild(PageLayoutContext $context, Container $container, int $columnNumber, int $recordUid, ?array $defVals): string diff --git a/Classes/Command/DeleteChildrenWithNonExistingParentCommand.php b/Classes/Command/DeleteChildrenWithNonExistingParentCommand.php index b6cf9a24..6c3dd49e 100644 --- a/Classes/Command/DeleteChildrenWithNonExistingParentCommand.php +++ b/Classes/Command/DeleteChildrenWithNonExistingParentCommand.php @@ -15,6 +15,7 @@ use B13\Container\Integrity\Error\NonExistingParentWarning; use B13\Container\Integrity\Integrity; use B13\Container\Integrity\IntegrityFix; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -22,22 +23,14 @@ use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[AsCommand( + name: 'container:deleteChildrenWithNonExistingParent', + description: 'delete all child records with a non existing parent record (they are displayed as unsued)' +)] class DeleteChildrenWithNonExistingParentCommand extends Command { - /** - * @var Integrity - */ - protected $integrity; - - /** - * @var IntegrityFix - */ - protected $integrityFix; - - public function __construct(Integrity $integrity, IntegrityFix $integrityFix, ?string $name = null) + public function __construct(protected Integrity $integrity, protected IntegrityFix $integrityFix, ?string $name = null) { - $this->integrity = $integrity; - $this->integrityFix = $integrityFix; parent::__construct($name); } @@ -51,6 +44,6 @@ public function execute(InputInterface $input, OutputInterface $output): int $this->integrityFix->deleteChildrenWithNonExistingParent($warning); } } - return 0; + return Command::SUCCESS; } } diff --git a/Classes/Command/DeleteChildrenWithUnusedColPosCommand.php b/Classes/Command/DeleteChildrenWithUnusedColPosCommand.php index 44aa6c82..67840a69 100644 --- a/Classes/Command/DeleteChildrenWithUnusedColPosCommand.php +++ b/Classes/Command/DeleteChildrenWithUnusedColPosCommand.php @@ -15,6 +15,7 @@ use B13\Container\Integrity\Error\UnusedColPosWarning; use B13\Container\Integrity\Integrity; use B13\Container\Integrity\IntegrityFix; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -22,22 +23,14 @@ use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[AsCommand( + name: 'container:deleteChildrenWithUnusedColPos', + description: 'delete all child records with a colPos that is not available for the parent CType (they are displayed as unsued)' +)] class DeleteChildrenWithUnusedColPosCommand extends Command { - /** - * @var Integrity - */ - protected $integrity; - - /** - * @var IntegrityFix - */ - protected $integrityFix; - - public function __construct(Integrity $integrity, IntegrityFix $integrityFix, ?string $name = null) + public function __construct(protected Integrity $integrity, protected IntegrityFix $integrityFix, ?string $name = null) { - $this->integrity = $integrity; - $this->integrityFix = $integrityFix; parent::__construct($name); } @@ -51,6 +44,6 @@ public function execute(InputInterface $input, OutputInterface $output): int $this->integrityFix->deleteChildrenWithUnusedColPos($warning); } } - return 0; + return Command::SUCCESS; } } diff --git a/Classes/Command/DeleteChildrenWithWrongPidCommand.php b/Classes/Command/DeleteChildrenWithWrongPidCommand.php index ba9271c9..0c2ff78f 100644 --- a/Classes/Command/DeleteChildrenWithWrongPidCommand.php +++ b/Classes/Command/DeleteChildrenWithWrongPidCommand.php @@ -15,6 +15,7 @@ use B13\Container\Integrity\Error\WrongPidError; use B13\Container\Integrity\Integrity; use B13\Container\Integrity\IntegrityFix; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -22,22 +23,14 @@ use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[AsCommand( + name: 'container:deleteChildrenWithWrongPid', + description: 'delete all child records with pid neq containers pid' +)] class DeleteChildrenWithWrongPidCommand extends Command { - /** - * @var Integrity - */ - protected $integrity; - - /** - * @var IntegrityFix - */ - protected $integrityFix; - - public function __construct(Integrity $integrity, IntegrityFix $integrityFix, ?string $name = null) + public function __construct(protected Integrity $integrity, protected IntegrityFix $integrityFix, ?string $name = null) { - $this->integrity = $integrity; - $this->integrityFix = $integrityFix; parent::__construct($name); } diff --git a/Classes/Command/FixContainerParentForConnectedModeCommand.php b/Classes/Command/FixContainerParentForConnectedModeCommand.php index bfeaa004..d7d8ecb8 100644 --- a/Classes/Command/FixContainerParentForConnectedModeCommand.php +++ b/Classes/Command/FixContainerParentForConnectedModeCommand.php @@ -15,26 +15,19 @@ use B13\Container\Integrity\Error\ChildInTranslatedContainerError; use B13\Container\Integrity\Integrity; use B13\Container\Integrity\IntegrityFix; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'container:fixContainerParentForConnectedMode', + description: 'tx_container_parent of children in connected mode should point to default language container' +)] class FixContainerParentForConnectedModeCommand extends Command { - /** - * @var Integrity - */ - protected $integrity; - - /** - * @var IntegrityFix - */ - protected $integrityFix; - - public function __construct(Integrity $integrity, IntegrityFix $integrityFix, ?string $name = null) + public function __construct(protected Integrity $integrity, protected IntegrityFix $integrityFix, ?string $name = null) { - $this->integrity = $integrity; - $this->integrityFix = $integrityFix; parent::__construct($name); } @@ -46,6 +39,6 @@ public function execute(InputInterface $input, OutputInterface $output): int $this->integrityFix->changeContainerParentToDefaultLanguageContainer($error); } } - return 0; + return Command::SUCCESS; } } diff --git a/Classes/Command/FixLanguageModeCommand.php b/Classes/Command/FixLanguageModeCommand.php index 356be0ed..3077cb08 100644 --- a/Classes/Command/FixLanguageModeCommand.php +++ b/Classes/Command/FixLanguageModeCommand.php @@ -15,26 +15,19 @@ use B13\Container\Integrity\Error\WrongL18nParentError; use B13\Container\Integrity\Integrity; use B13\Container\Integrity\IntegrityFix; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'container:fixLanguageMode', + description: 'connect children of connected container if possible, else disconnect container' +)] class FixLanguageModeCommand extends Command { - /** - * @var Integrity - */ - protected $integrity; - - /** - * @var IntegrityFix - */ - protected $integrityFix; - - public function __construct(Integrity $integrity, IntegrityFix $integrityFix, ?string $name = null) + public function __construct(protected Integrity $integrity, protected IntegrityFix $integrityFix, ?string $name = null) { - $this->integrity = $integrity; - $this->integrityFix = $integrityFix; parent::__construct($name); } @@ -48,6 +41,6 @@ public function execute(InputInterface $input, OutputInterface $output): int } } $this->integrityFix->languageMode($errors); - return 0; + return Command::SUCCESS; } } diff --git a/Classes/Command/IntegrityCommand.php b/Classes/Command/IntegrityCommand.php index 24e5b7c0..a35ccc03 100644 --- a/Classes/Command/IntegrityCommand.php +++ b/Classes/Command/IntegrityCommand.php @@ -13,21 +13,20 @@ */ use B13\Container\Integrity\Integrity; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand( + name: 'container:integrity', + description: 'Checks integrity of containers' +)] class IntegrityCommand extends Command { - /** - * @var Integrity - */ - protected $integrity; - - public function __construct(Integrity $integrity, ?string $name = null) + public function __construct(protected Integrity $integrity, ?string $name = null) { - $this->integrity = $integrity; parent::__construct($name); } @@ -52,6 +51,6 @@ public function execute(InputInterface $input, OutputInterface $output): int if (count($res['warnings']) === 0 && count($res['errors']) === 0) { $io->success('Good Job, no errors/warnings!'); } - return 0; + return Command::SUCCESS; } } diff --git a/Classes/Command/SortingCommand.php b/Classes/Command/SortingCommand.php index 26e4a91b..faf13951 100644 --- a/Classes/Command/SortingCommand.php +++ b/Classes/Command/SortingCommand.php @@ -13,6 +13,7 @@ */ use B13\Container\Integrity\Sorting; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -22,13 +23,12 @@ use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[AsCommand( + name: 'container:sorting', + description: 'Resort Content Elements' +)] class SortingCommand extends Command { - /** - * @var Sorting - */ - protected $sorting; - protected function configure() { $this->addArgument('pid', InputArgument::OPTIONAL, 'limit to this pid', 0); @@ -41,10 +41,9 @@ protected function configure() ); } - public function __construct(Sorting $sorting, ?string $name = null) + public function __construct(protected Sorting $sorting, ?string $name = null) { parent::__construct($name); - $this->sorting = $sorting; } public function execute(InputInterface $input, OutputInterface $output): int @@ -70,6 +69,6 @@ public function execute(InputInterface $input, OutputInterface $output): int } } - return self::SUCCESS; + return Command::SUCCESS; } } diff --git a/Classes/Command/SortingInPageCommand.php b/Classes/Command/SortingInPageCommand.php index 7dd4dc50..99fda2ef 100644 --- a/Classes/Command/SortingInPageCommand.php +++ b/Classes/Command/SortingInPageCommand.php @@ -13,6 +13,7 @@ */ use B13\Container\Integrity\SortingInPage; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -22,13 +23,12 @@ use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[AsCommand( + name: 'container:sorting-in-page', + description: 'Resort Content Elements' +)] class SortingInPageCommand extends Command { - /** - * @var SortingInPage - */ - protected $sorting; - protected function configure() { $this->addArgument('pid', InputArgument::OPTIONAL, 'limit to this pid', 0); @@ -41,10 +41,9 @@ protected function configure() ); } - public function __construct(SortingInPage $sorting, ?string $name = null) + public function __construct(protected SortingInPage $sorting, ?string $name = null) { parent::__construct($name); - $this->sorting = $sorting; } public function execute(InputInterface $input, OutputInterface $output): int @@ -65,6 +64,6 @@ public function execute(InputInterface $input, OutputInterface $output): int if (empty($errors)) { $output->writeln('migration finished'); } - return 0; + return Command::SUCCESS; } } diff --git a/Classes/ContentDefender/ContainerColumnConfigurationService.php b/Classes/ContentDefender/ContainerColumnConfigurationService.php index e5c196e6..7d21af16 100644 --- a/Classes/ContentDefender/ContainerColumnConfigurationService.php +++ b/Classes/ContentDefender/ContainerColumnConfigurationService.php @@ -17,25 +17,20 @@ use B13\Container\Domain\Factory\Exception; use B13\Container\Domain\Model\Container; use B13\Container\Tca\Registry; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\SingletonInterface; -class ContainerColumnConfigurationService implements SingletonInterface +#[Autoconfigure(public: true)] +class ContainerColumnConfigurationService { - /** - * @var Registry - */ - protected $tcaRegistry; - - /** - * @var ContainerFactory - */ - protected $containerFactory; - protected $copyMapping = []; protected $contentDefenderContainerDataHandlerHookIsLocked = false; + public function __construct(protected ContainerFactory $containerFactory, protected Registry $tcaRegistry) + { + } + public function startCmdMap(): void { $this->contentDefenderContainerDataHandlerHookIsLocked = true; @@ -51,12 +46,6 @@ public function isContentDefenderContainerDataHandlerHookLooked(): bool return $this->contentDefenderContainerDataHandlerHookIsLocked; } - public function __construct(ContainerFactory $containerFactory, Registry $tcaRegistry) - { - $this->containerFactory = $containerFactory; - $this->tcaRegistry = $tcaRegistry; - } - protected function getRecord(int $uid): ?array { return BackendUtility::getRecord('tt_content', $uid); diff --git a/Classes/ContentDefender/Hooks/ColumnConfigurationManipulationHook.php b/Classes/ContentDefender/Hooks/ColumnConfigurationManipulationHook.php index d5b564cc..13a86233 100644 --- a/Classes/ContentDefender/Hooks/ColumnConfigurationManipulationHook.php +++ b/Classes/ContentDefender/Hooks/ColumnConfigurationManipulationHook.php @@ -16,25 +16,15 @@ use B13\Container\Domain\Factory\Exception; use B13\Container\Tca\Registry; use IchHabRecht\ContentDefender\BackendLayout\ColumnConfigurationManipulationInterface; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Http\ServerRequest; +#[Autoconfigure(public: true)] class ColumnConfigurationManipulationHook implements ColumnConfigurationManipulationInterface { - /** - * @var Registry - */ - protected $tcaRegistry; - - /** - * @var ContainerFactory - */ - protected $containerFactory; - - public function __construct(ContainerFactory $containerFactory, Registry $tcaRegistry) + public function __construct(protected ContainerFactory $containerFactory, protected Registry $tcaRegistry) { - $this->containerFactory = $containerFactory; - $this->tcaRegistry = $tcaRegistry; } public function manipulateConfiguration(array $configuration, int $colPos, $recordUid): array diff --git a/Classes/ContentDefender/Xclasses/CommandMapHook.php b/Classes/ContentDefender/Xclasses/CommandMapHook.php index 159c8e4b..3ebe5464 100644 --- a/Classes/ContentDefender/Xclasses/CommandMapHook.php +++ b/Classes/ContentDefender/Xclasses/CommandMapHook.php @@ -17,18 +17,13 @@ use IchHabRecht\ContentDefender\Hooks\CmdmapDataHandlerHook; use IchHabRecht\ContentDefender\Repository\ContentRepository; use TYPO3\CMS\Core\DataHandling\DataHandler; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; class CommandMapHook extends CmdmapDataHandlerHook { - /** - * @var ContainerColumnConfigurationService - */ - protected $containerColumnConfigurationService; - - protected $mapping = []; + protected ContainerColumnConfigurationService $containerColumnConfigurationService; + protected array $mapping = []; public function __construct( ?ContentRepository $contentRepository = null, @@ -72,20 +67,14 @@ public function processCmdmap_beforeStart(DataHandler $dataHandler): void if ($this->containerColumnConfigurationService->isMaxitemsReachedByContainenrId((int)$data['update']['tx_container_parent'], (int)$data['update']['colPos'], $useChildId)) { unset($dataHandler->cmdmap['tt_content'][$id]); - $recpid = null; - $detailsNumber = null; - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 13) { - $recpid = 0; - $detailsNumber = 28; - } $dataHandler->log( 'tt_content', $id, 1, - $recpid, + null, 1, 'The command couldn\'t be executed due to reached maxitems configuration', - $detailsNumber + null ); } } diff --git a/Classes/ContentDefender/Xclasses/DatamapHook.php b/Classes/ContentDefender/Xclasses/DatamapHook.php index 8e68d33b..ea5ae6d9 100644 --- a/Classes/ContentDefender/Xclasses/DatamapHook.php +++ b/Classes/ContentDefender/Xclasses/DatamapHook.php @@ -17,16 +17,12 @@ use IchHabRecht\ContentDefender\Hooks\DatamapDataHandlerHook; use IchHabRecht\ContentDefender\Repository\ContentRepository; use TYPO3\CMS\Core\DataHandling\DataHandler; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; class DatamapHook extends DatamapDataHandlerHook { - /** - * @var ContainerColumnConfigurationService - */ - protected $containerColumnConfigurationService; + protected ContainerColumnConfigurationService $containerColumnConfigurationService; public function __construct( ?ContentRepository $contentRepository = null, @@ -36,9 +32,6 @@ public function __construct( parent::__construct($contentRepository); } - /** - * @param DataHandler $dataHandler - */ public function processDatamap_beforeStart(DataHandler $dataHandler): void { if (is_array($dataHandler->datamap['tt_content'] ?? null) && @@ -59,20 +52,14 @@ public function processDatamap_beforeStart(DataHandler $dataHandler): void if ($this->containerColumnConfigurationService->isMaxitemsReachedByContainenrId($containerId, (int)$values['colPos'])) { unset($dataHandler->datamap['tt_content'][$id]); - $recpid = null; - $detailsNumber = null; - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 13) { - $recpid = 0; - $detailsNumber = 28; - } $dataHandler->log( 'tt_content', $id, 1, - $recpid, + null, 1, 'The command couldn\'t be executed due to reached maxitems configuration', - $detailsNumber + null ); } } diff --git a/Classes/DataProcessing/ContainerProcessor.php b/Classes/DataProcessing/ContainerProcessor.php index ada39778..b8c1b6ab 100644 --- a/Classes/DataProcessing/ContainerProcessor.php +++ b/Classes/DataProcessing/ContainerProcessor.php @@ -15,28 +15,18 @@ use B13\Container\Domain\Factory\Exception; use B13\Container\Domain\Factory\FrontendContainerFactory; use B13\Container\Domain\Model\Container; -use Psr\Http\Message\ServerRequestInterface; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface; +#[Autoconfigure(public: true)] class ContainerProcessor implements DataProcessorInterface { - /** - * @var ContentDataProcessor - */ - protected $contentDataProcessor; - - protected Context $context; - protected FrontendContainerFactory $frontendContainerFactory; - - public function __construct(ContentDataProcessor $contentDataProcessor, Context $context, FrontendContainerFactory $frontendContainerFactory) + public function __construct(protected ContentDataProcessor $contentDataProcessor, protected Context $context, protected FrontendContainerFactory $frontendContainerFactory) { - $this->contentDataProcessor = $contentDataProcessor; - $this->context = $context; - $this->frontendContainerFactory = $frontendContainerFactory; } public function process( @@ -119,9 +109,4 @@ protected function processColPos( $processedData[$as] = $children; return $processedData; } - - protected function getRequest(): ServerRequestInterface - { - return $GLOBALS['TYPO3_REQUEST']; - } } diff --git a/Classes/Domain/Factory/ContainerFactory.php b/Classes/Domain/Factory/ContainerFactory.php index 13558f42..8d3f419f 100644 --- a/Classes/Domain/Factory/ContainerFactory.php +++ b/Classes/Domain/Factory/ContainerFactory.php @@ -16,32 +16,15 @@ use B13\Container\Tca\Registry; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Context\Context; -use TYPO3\CMS\Core\Information\Typo3Version; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Versioning\VersionState; -class ContainerFactory implements SingletonInterface +class ContainerFactory { - /** - * @var Database - */ - protected $database; + protected int $workspaceId = 0; - /** - * @var Registry - */ - protected $tcaRegistry; - - /** - * @var int - */ - protected $workspaceId = 0; - - public function __construct(Database $database, Registry $tcaRegistry, Context $context) + public function __construct(protected Database $database, protected Registry $tcaRegistry, Context $context) { - $this->database = $database; - $this->tcaRegistry = $tcaRegistry; $this->workspaceId = (int)$context->getPropertyFromAspect('workspace', 'id'); } @@ -108,14 +91,8 @@ protected function workspaceOverlay(array $records): array $filtered = []; foreach ($records as $row) { BackendUtility::workspaceOL('tt_content', $row, $this->workspaceId, true); - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 12) { - if ($row && VersionState::tryFrom($row['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) { - $filtered[] = $row; - } - } else { - if ($row && !VersionState::cast($row['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER)) { - $filtered[] = $row; - } + if ($row && VersionState::tryFrom($row['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) { + $filtered[] = $row; } } return $filtered; diff --git a/Classes/Domain/Factory/Database.php b/Classes/Domain/Factory/Database.php index 195143e7..1f6f9024 100644 --- a/Classes/Domain/Factory/Database.php +++ b/Classes/Domain/Factory/Database.php @@ -18,20 +18,12 @@ use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; use TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -class Database implements SingletonInterface +class Database { - /** - * @var int - */ - protected $backendUserId = 0; - - /** - * @var int - */ - protected $workspaceId = 0; + protected int $backendUserId = 0; + protected int $workspaceId = 0; public function __construct(Context $context) { diff --git a/Classes/Domain/Factory/FrontendContainerFactory.php b/Classes/Domain/Factory/FrontendContainerFactory.php index 6fc6a5a8..d01a61cb 100644 --- a/Classes/Domain/Factory/FrontendContainerFactory.php +++ b/Classes/Domain/Factory/FrontendContainerFactory.php @@ -16,16 +16,12 @@ use B13\Container\Tca\Registry; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\LanguageAspect; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; -class FrontendContainerFactory implements SingletonInterface +class FrontendContainerFactory { - protected Registry $tcaRegistry; - - public function __construct(Registry $tcaRegistry) + public function __construct(protected Registry $tcaRegistry) { - $this->tcaRegistry = $tcaRegistry; } public function buildContainer(ContentObjectRenderer $cObj, Context $context, ?int $uid = null): Container diff --git a/Classes/Domain/Factory/PageView/Backend/ContainerFactory.php b/Classes/Domain/Factory/PageView/Backend/ContainerFactory.php index 6ae67079..9755551a 100644 --- a/Classes/Domain/Factory/PageView/Backend/ContainerFactory.php +++ b/Classes/Domain/Factory/PageView/Backend/ContainerFactory.php @@ -18,19 +18,13 @@ class ContainerFactory extends \B13\Container\Domain\Factory\ContainerFactory { - /** - * @var ContentStorage - */ - protected $contentStorage; - public function __construct( Database $database, Registry $tcaRegistry, Context $context, - ContentStorage $contentStorage + protected ContentStorage $contentStorage ) { parent::__construct($database, $tcaRegistry, $context); - $this->contentStorage = $contentStorage; } protected function children(array $containerRecord, int $language): array diff --git a/Classes/Domain/Factory/PageView/Backend/ContentStorage.php b/Classes/Domain/Factory/PageView/Backend/ContentStorage.php index 4b2e1e6a..ccfe1260 100644 --- a/Classes/Domain/Factory/PageView/Backend/ContentStorage.php +++ b/Classes/Domain/Factory/PageView/Backend/ContentStorage.php @@ -15,30 +15,15 @@ use B13\Container\Domain\Factory\Database; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Context\Context; -use TYPO3\CMS\Core\Information\Typo3Version; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Versioning\VersionState; class ContentStorage { - /** - * @var ?mixed[] - */ - protected $records; + protected array $records = []; + protected int $workspaceId = 0; - /** - * @var Database - */ - protected $database; - - /** - * @var int - */ - protected $workspaceId = 0; - - public function __construct(Database $database, Context $context) + public function __construct(protected Database $database, Context $context) { - $this->database = $database; $this->workspaceId = (int)$context->getPropertyFromAspect('workspace', 'id'); } @@ -73,6 +58,9 @@ public function getContainerChildren(array $containerRecord, int $language): arr } else { $uid = (int)$containerRecord['uid']; } + if (!isset($this->records[$pid])) { + $this->records[$pid] = []; + } if (!isset($this->records[$pid][$language])) { $this->records[$pid][$language] = $this->buildRecords($pid, $language); } @@ -87,14 +75,8 @@ public function workspaceOverlay(array $records): array $filtered = []; foreach ($records as $row) { BackendUtility::workspaceOL('tt_content', $row, $this->workspaceId, true); - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 12) { - if ($row && VersionState::tryFrom($row['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) { - $filtered[] = $row; - } - } else { - if ($row && !VersionState::cast($row['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER)) { - $filtered[] = $row; - } + if ($row && VersionState::tryFrom($row['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) { + $filtered[] = $row; } } return $filtered; @@ -103,14 +85,8 @@ public function workspaceOverlay(array $records): array public function containerRecordWorkspaceOverlay(array $record): ?array { BackendUtility::workspaceOL('tt_content', $record, $this->workspaceId, false); - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 12) { - if ($record && VersionState::tryFrom($record['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) { - return $record; - } - } else { - if ($record && !VersionState::cast($record['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER)) { - return $record; - } + if ($record && VersionState::tryFrom($record['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) { + return $record; } return null; } diff --git a/Classes/Domain/Model/Container.php b/Classes/Domain/Model/Container.php index 805d12b1..4290a7f1 100644 --- a/Classes/Domain/Model/Container.php +++ b/Classes/Domain/Model/Container.php @@ -14,36 +14,10 @@ class Container { - /** - * @var array - */ - protected $containerRecord; - - /** - * @var array - */ - protected $childRecords; - - /** - * @var int - */ - protected $language = 0; - - /** - * @param array $containerRecord - * @param array $childRecords - * @param int $language - */ - public function __construct(array $containerRecord, array $childRecords, $language = 0) + public function __construct(protected array $containerRecord, protected array $childRecords, protected $language = 0) { - $this->containerRecord = $containerRecord; - $this->childRecords = $childRecords; - $this->language = $language; } - /** - * @return int - */ public function getUid(): int { return (int)$this->containerRecord['uid']; @@ -57,9 +31,6 @@ public function getUidOfLiveWorkspace(): int return $this->getUid(); } - /** - * @return int - */ public function getPid(): int { if (!empty($this->containerRecord['_ORIG_pid'])) { @@ -68,41 +39,26 @@ public function getPid(): int return (int)$this->containerRecord['pid']; } - /** - * @return bool - */ public function isConnectedMode(): bool { return (int)$this->containerRecord['sys_language_uid'] === 0; } - /** - * @return int - */ public function getLanguage(): int { return $this->language; } - /** - * @return string - */ public function getCType(): string { return $this->containerRecord['CType']; } - /** - * @return array - */ public function getContainerRecord(): array { return $this->containerRecord; } - /** - * @return array - */ public function getChildRecords(): array { $childRecords = []; @@ -112,10 +68,6 @@ public function getChildRecords(): array return $childRecords; } - /** - * @param int $colPos - * @return array - */ public function getChildrenByColPos(int $colPos): array { if (empty($this->childRecords[$colPos])) { @@ -137,9 +89,6 @@ public function hasChildInColPos(int $colPos, int $childUid): bool return false; } - /** - * @return array - */ public function getChildrenColPos(): array { return array_keys($this->childRecords); diff --git a/Classes/Domain/Service/ContainerService.php b/Classes/Domain/Service/ContainerService.php index 1256cb34..b5d85b87 100644 --- a/Classes/Domain/Service/ContainerService.php +++ b/Classes/Domain/Service/ContainerService.php @@ -15,24 +15,11 @@ use B13\Container\Domain\Factory\ContainerFactory; use B13\Container\Domain\Model\Container; use B13\Container\Tca\Registry; -use TYPO3\CMS\Core\SingletonInterface; -class ContainerService implements SingletonInterface +class ContainerService { - /** - * @var Registry - */ - protected $tcaRegistry; - - /** - * @var ContainerFactory - */ - protected $containerFactory; - - public function __construct(Registry $tcaRegistry, ContainerFactory $containerFactory) + public function __construct(protected Registry $tcaRegistry, protected ContainerFactory $containerFactory) { - $this->tcaRegistry = $tcaRegistry; - $this->containerFactory = $containerFactory; } public function getNewContentElementAtTopTargetInColumn(Container $container, int $targetColPos): int diff --git a/Classes/Events/BeforeContainerConfigurationIsAppliedEvent.php b/Classes/Events/BeforeContainerConfigurationIsAppliedEvent.php index 95e8cb1a..fc4e9ab1 100644 --- a/Classes/Events/BeforeContainerConfigurationIsAppliedEvent.php +++ b/Classes/Events/BeforeContainerConfigurationIsAppliedEvent.php @@ -16,12 +16,10 @@ final class BeforeContainerConfigurationIsAppliedEvent { - protected ContainerConfiguration $containerConfiguration; protected bool $skip = false; - public function __construct(ContainerConfiguration $containerConfiguration) + public function __construct(protected ContainerConfiguration $containerConfiguration) { - $this->containerConfiguration = $containerConfiguration; } public function skip(): void diff --git a/Classes/Events/BeforeContainerPreviewIsRenderedEvent.php b/Classes/Events/BeforeContainerPreviewIsRenderedEvent.php index b56efe3b..8d9087e9 100644 --- a/Classes/Events/BeforeContainerPreviewIsRenderedEvent.php +++ b/Classes/Events/BeforeContainerPreviewIsRenderedEvent.php @@ -14,25 +14,12 @@ use B13\Container\Domain\Model\Container; use TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid; -use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem; -use TYPO3\CMS\Fluid\View\StandaloneView; +use TYPO3\CMS\Core\View\ViewInterface; final class BeforeContainerPreviewIsRenderedEvent { - protected Container $container; - - protected StandaloneView $view; - - protected Grid $grid; - - protected GridColumnItem $item; - - public function __construct(Container $container, StandaloneView $view, Grid $grid, GridColumnItem $item) + public function __construct(protected Container $container, protected ViewInterface $view, protected Grid $grid) { - $this->container = $container; - $this->view = $view; - $this->grid = $grid; - $this->item = $item; } public function getContainer(): Container @@ -40,7 +27,7 @@ public function getContainer(): Container return $this->container; } - public function getView(): StandaloneView + public function getView(): ViewInterface { return $this->view; } @@ -49,10 +36,4 @@ public function getGrid(): Grid { return $this->grid; } - - public function getItem(): GridColumnItem - { - trigger_error('gridColumItem property will be removed on next major release', E_USER_DEPRECATED); - return $this->item; - } } diff --git a/Classes/Hooks/Datahandler/CommandMapAfterFinishHook.php b/Classes/Hooks/Datahandler/CommandMapAfterFinishHook.php index 7971a5e2..f506e202 100644 --- a/Classes/Hooks/Datahandler/CommandMapAfterFinishHook.php +++ b/Classes/Hooks/Datahandler/CommandMapAfterFinishHook.php @@ -12,19 +12,15 @@ * of the License, or any later version. */ +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[Autoconfigure(public: true)] class CommandMapAfterFinishHook { - /** - * @var Database - */ - protected $database; - - public function __construct(Database $database) + public function __construct(protected Database $database) { - $this->database = $database; } public function processCmdmap_afterFinish(DataHandler $dataHandler): void diff --git a/Classes/Hooks/Datahandler/CommandMapBeforeStartHook.php b/Classes/Hooks/Datahandler/CommandMapBeforeStartHook.php index d4aa1ed3..de7abc5f 100644 --- a/Classes/Hooks/Datahandler/CommandMapBeforeStartHook.php +++ b/Classes/Hooks/Datahandler/CommandMapBeforeStartHook.php @@ -17,42 +17,19 @@ use B13\Container\Domain\Factory\Exception; use B13\Container\Domain\Service\ContainerService; use B13\Container\Tca\Registry; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Core\DataHandling\DataHandler; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[Autoconfigure(public: true)] class CommandMapBeforeStartHook { - /** - * @var Registry - */ - protected $tcaRegistry; - - /** - * @var ContainerFactory - */ - protected $containerFactory; - - /** - * @var Database - */ - protected $database; - - /** - * @var ContainerService - */ - protected $containerService; - public function __construct( - ContainerFactory $containerFactory, - Registry $tcaRegistry, - Database $database, - ContainerService $containerService + protected ContainerFactory $containerFactory, + protected Registry $tcaRegistry, + protected Database $database, + protected ContainerService $containerService ) { - $this->containerFactory = $containerFactory; - $this->tcaRegistry = $tcaRegistry; - $this->database = $database; - $this->containerService = $containerService; } public function processCmdmap_beforeStart(DataHandler $dataHandler): void @@ -302,20 +279,14 @@ protected function dataFromContainerIdColPos(array $data): array protected function logAndUnsetCmd(int $id, string $cmd, string $message, DataHandler $dataHandler): void { - $recpid = null; - $detailsNumber = null; - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 13) { - $recpid = 0; - $detailsNumber = 28; - } $dataHandler->log( 'tt_content', $id, 1, - $recpid, + null, 1, $cmd . ' ' . $message, - $detailsNumber + null ); unset($dataHandler->cmdmap['tt_content'][$id][$cmd]); if (!empty($dataHandler->cmdmap['tt_content'][$id])) { diff --git a/Classes/Hooks/Datahandler/CommandMapPostProcessingHook.php b/Classes/Hooks/Datahandler/CommandMapPostProcessingHook.php index 6d0d358b..b4d8c418 100644 --- a/Classes/Hooks/Datahandler/CommandMapPostProcessingHook.php +++ b/Classes/Hooks/Datahandler/CommandMapPostProcessingHook.php @@ -15,24 +15,17 @@ use B13\Container\Domain\Factory\ContainerFactory; use B13\Container\Domain\Factory\Exception; use B13\Container\Domain\Service\ContainerService; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; +#[Autoconfigure(public: true)] class CommandMapPostProcessingHook { - /** - * @var ContainerFactory - */ - protected $containerFactory; - - protected ContainerService $containerService; - - public function __construct(ContainerFactory $containerFactory, ContainerService $containerService) + public function __construct(protected ContainerFactory $containerFactory, protected ContainerService $containerService) { - $this->containerFactory = $containerFactory; - $this->containerService = $containerService; } public function processCmdmap_postProcess(string $command, string $table, $id, $value, DataHandler $dataHandler, $pasteUpdate, $pasteDatamap): void diff --git a/Classes/Hooks/Datahandler/Database.php b/Classes/Hooks/Datahandler/Database.php index c2c36e7f..0b06e6a8 100644 --- a/Classes/Hooks/Datahandler/Database.php +++ b/Classes/Hooks/Datahandler/Database.php @@ -18,10 +18,9 @@ use TYPO3\CMS\Core\Database\Query\Restriction\EndTimeRestriction; use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction; use TYPO3\CMS\Core\Database\Query\Restriction\StartTimeRestriction; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -class Database implements SingletonInterface +class Database { protected function getQueryBuilder(): QueryBuilder { diff --git a/Classes/Hooks/Datahandler/DatamapBeforeStartHook.php b/Classes/Hooks/Datahandler/DatamapBeforeStartHook.php index 705ab80d..8b7dfc0c 100644 --- a/Classes/Hooks/Datahandler/DatamapBeforeStartHook.php +++ b/Classes/Hooks/Datahandler/DatamapBeforeStartHook.php @@ -16,40 +16,18 @@ use B13\Container\Domain\Factory\Exception; use B13\Container\Domain\Service\ContainerService; use B13\Container\Tca\Registry; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Core\DataHandling\DataHandler; +#[Autoconfigure(public: true)] class DatamapBeforeStartHook { - /** - * @var ContainerFactory - */ - protected $containerFactory; - - /** - * @var Database - */ - protected $database; - - /** - * @var ContainerService - */ - protected $containerService; - - /** - * @var Registry - */ - protected $tcaRegistry; - public function __construct( - ContainerFactory $containerFactory, - Database $database, - Registry $tcaRegistry, - ContainerService $containerService + protected ContainerFactory $containerFactory, + protected Database $database, + protected Registry $tcaRegistry, + protected ContainerService $containerService ) { - $this->containerFactory = $containerFactory; - $this->database = $database; - $this->tcaRegistry = $tcaRegistry; - $this->containerService = $containerService; } public function processDatamap_beforeStart(DataHandler $dataHandler): void diff --git a/Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php b/Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php index 205f9090..43de932e 100644 --- a/Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php +++ b/Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php @@ -16,41 +16,19 @@ use B13\Container\Domain\Factory\Exception; use B13\Container\Domain\Service\ContainerService; use B13\Container\Tca\Registry; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Utility\MathUtility; +#[Autoconfigure(public: true)] class DatamapPreProcessFieldArrayHook { - /** - * @var ContainerFactory - */ - protected $containerFactory; - - /** - * @var Database - */ - protected $database; - - /** - * @var ContainerService - */ - protected $containerService; - - /** - * @var Registry - */ - protected $tcaRegistry; - public function __construct( - ContainerFactory $containerFactory, - Database $database, - Registry $tcaRegistry, - ContainerService $containerService + protected ContainerFactory $containerFactory, + protected Database $database, + protected Registry $tcaRegistry, + protected ContainerService $containerService ) { - $this->containerFactory = $containerFactory; - $this->database = $database; - $this->tcaRegistry = $tcaRegistry; - $this->containerService = $containerService; } protected function newElementAfterContainer(array $incomingFieldArray): array diff --git a/Classes/Hooks/Datahandler/DeleteHook.php b/Classes/Hooks/Datahandler/DeleteHook.php index bdfdfd8b..d1454efa 100644 --- a/Classes/Hooks/Datahandler/DeleteHook.php +++ b/Classes/Hooks/Datahandler/DeleteHook.php @@ -14,20 +14,16 @@ use B13\Container\Domain\Factory\ContainerFactory; use B13\Container\Domain\Factory\Exception; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[Autoconfigure(public: true)] class DeleteHook { - /** - * @var ContainerFactory - */ - protected $containerFactory; - - public function __construct(ContainerFactory $containerFactory) + public function __construct(protected ContainerFactory $containerFactory) { - $this->containerFactory = $containerFactory; } public function processCmdmap_deleteAction(string $table, int $id, array $recordToDelete, bool $recordWasDeleted, DataHandler $dataHandler): void diff --git a/Classes/Hooks/UsedRecords.php b/Classes/Hooks/UsedRecords.php deleted file mode 100644 index b2d8004e..00000000 --- a/Classes/Hooks/UsedRecords.php +++ /dev/null @@ -1,60 +0,0 @@ -containerFactory = $containerFactory; - $this->tcaRegistry = $tcaRegistry; - } - - public function addContainerChildren(array $params, PageLayoutView $pageLayoutView): bool - { - $record = $params['record']; - - if (isset($record['tx_container_parent']) && $record['tx_container_parent'] > 0) { - try { - $container = $this->containerFactory->buildContainer((int)$record['tx_container_parent']); - $columns = $this->tcaRegistry->getAvailableColumns($container->getCType()); - foreach ($columns as $column) { - if ($column['colPos'] === (int)$record['colPos']) { - if ($record['sys_language_uid'] > 0 && $container->isConnectedMode()) { - return $container->hasChildInColPos((int)$record['colPos'], (int)$record['l18n_parent']); - } - return $container->hasChildInColPos((int)$record['colPos'], (int)$record['uid']); - } - } - return false; - } catch (Exception $e) { - } - } - return $params['used']; - } -} diff --git a/Classes/Hooks/WizardItems.php b/Classes/Hooks/WizardItems.php deleted file mode 100644 index f301658e..00000000 --- a/Classes/Hooks/WizardItems.php +++ /dev/null @@ -1,52 +0,0 @@ -getParentIdFromRequest(); - if ($parent !== null) { - foreach ($wizardItems as $key => $wizardItem) { - $wizardItems[$key]['tt_content_defValues']['tx_container_parent'] = $parent; - if (!isset($wizardItems[$key]['params'])) { - $wizardItems[$key]['params'] = '?defVals[tt_content][tx_container_parent]=' . $parent; - } else { - $wizardItems[$key]['params'] .= '&defVals[tt_content][tx_container_parent]=' . $parent; - } - } - } - } - - protected function getParentIdFromRequest(): ?int - { - $request = $this->getServerRequest(); - if ($request === null) { - return null; - } - $queryParams = $request->getQueryParams(); - if (isset($queryParams['tx_container_parent']) && (int)$queryParams['tx_container_parent'] > 0) { - return (int)$queryParams['tx_container_parent']; - } - return null; - } - - protected function getServerRequest(): ?ServerRequest - { - return $GLOBALS['TYPO3_REQUEST'] ?? null; - } -} diff --git a/Classes/Integrity/Database.php b/Classes/Integrity/Database.php index 22a905ca..7157aa5e 100644 --- a/Classes/Integrity/Database.php +++ b/Classes/Integrity/Database.php @@ -16,10 +16,9 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -class Database implements SingletonInterface +class Database { private $fields = ['uid', 'pid', 'sys_language_uid', 'CType', 'l18n_parent', 'colPos', 'tx_container_parent', 'l10n_source', 'hidden', 'sorting']; diff --git a/Classes/Integrity/Error/ChildInTranslatedContainerError.php b/Classes/Integrity/Error/ChildInTranslatedContainerError.php index dd1cebe3..7c6302ad 100644 --- a/Classes/Integrity/Error/ChildInTranslatedContainerError.php +++ b/Classes/Integrity/Error/ChildInTranslatedContainerError.php @@ -16,25 +16,10 @@ class ChildInTranslatedContainerError implements ErrorInterface { private const IDENTIFIER = 'ChildInTranslatedContainerError'; - /** - * @var array - */ - protected $childRecord; + protected array $childRecord; + protected array $containerRecord; + protected string $errorMessage; - /** - * @var array - */ - protected $containerRecord; - - /** - * @var string - */ - protected $errorMessage; - - /** - * @param array $childRecord - * @param array $containerRecord - */ public function __construct(array $childRecord, array $containerRecord) { $this->childRecord = $childRecord; @@ -45,33 +30,21 @@ public function __construct(array $childRecord, array $containerRecord) . ' but should point to default language container record ' . $containerRecord['l18n_parent']; } - /** - * @return string - */ public function getErrorMessage(): string { return $this->errorMessage; } - /** - * @return int - */ public function getSeverity(): int { return ErrorInterface::ERROR; } - /** - * @return array - */ public function getChildRecord(): array { return $this->childRecord; } - /** - * @return array - */ public function getContainerRecord(): array { return $this->containerRecord; diff --git a/Classes/Integrity/Error/ErrorInterface.php b/Classes/Integrity/Error/ErrorInterface.php index 1d5cef0b..217ae93b 100644 --- a/Classes/Integrity/Error/ErrorInterface.php +++ b/Classes/Integrity/Error/ErrorInterface.php @@ -17,13 +17,7 @@ interface ErrorInterface public const ERROR = 2; public const WARNING = 1; - /** - * @return string - */ public function getErrorMessage(): string; - /** - * @return int - */ public function getSeverity(): int; } diff --git a/Classes/Integrity/Error/NonExistingParentWarning.php b/Classes/Integrity/Error/NonExistingParentWarning.php index 7fea49a0..7ad6574a 100644 --- a/Classes/Integrity/Error/NonExistingParentWarning.php +++ b/Classes/Integrity/Error/NonExistingParentWarning.php @@ -16,19 +16,9 @@ class NonExistingParentWarning implements ErrorInterface { private const IDENTIFIER = 'NonExistingParentWarning'; - /** - * @var array - */ - protected $childRecord; - - /** - * @var string - */ - protected $errorMessage; - - /** - * @param array $childRecord - */ + protected array $childRecord; + protected string $errorMessage; + public function __construct(array $childRecord) { $this->childRecord = $childRecord; @@ -42,17 +32,11 @@ public function getChildRecord(): array return $this->childRecord; } - /** - * @return string - */ public function getErrorMessage(): string { return $this->errorMessage; } - /** - * @return int - */ public function getSeverity(): int { return ErrorInterface::ERROR; diff --git a/Classes/Integrity/Error/UnusedColPosWarning.php b/Classes/Integrity/Error/UnusedColPosWarning.php index f61b3931..01600149 100644 --- a/Classes/Integrity/Error/UnusedColPosWarning.php +++ b/Classes/Integrity/Error/UnusedColPosWarning.php @@ -16,25 +16,10 @@ class UnusedColPosWarning implements ErrorInterface { private const IDENTIFIER = 'UnusedColPosWarning'; - /** - * @var array - */ - protected $childRecord; + protected array $childRecord; + protected array $containerRecord; + protected string $errorMessage; - /** - * @var array - */ - protected $containerRecord; - - /** - * @var string - */ - protected $errorMessage; - - /** - * @param array $childRecord - * @param array $containerRecord - */ public function __construct(array $childRecord, array $containerRecord) { $this->childRecord = $childRecord; @@ -46,25 +31,16 @@ public function __construct(array $childRecord, array $containerRecord) . ' with CType ' . $containerRecord['CType']; } - /** - * @return array - */ public function getChildRecord(): array { return $this->childRecord; } - /** - * @return string - */ public function getErrorMessage(): string { return $this->errorMessage; } - /** - * @return int - */ public function getSeverity(): int { return ErrorInterface::WARNING; diff --git a/Classes/Integrity/Error/WrongL18nParentError.php b/Classes/Integrity/Error/WrongL18nParentError.php index 1dc94c0c..37bdeaec 100644 --- a/Classes/Integrity/Error/WrongL18nParentError.php +++ b/Classes/Integrity/Error/WrongL18nParentError.php @@ -16,25 +16,10 @@ class WrongL18nParentError implements ErrorInterface { private const IDENTIFIER = 'WrongL18nParentError'; - /** - * @var array - */ - protected $childRecord; + protected array $childRecord; + protected array $containerRecord; + protected string $errorMessage; - /** - * @var array - */ - protected $containerRecord; - - /** - * @var string - */ - protected $errorMessage; - - /** - * @param array $childRecord - * @param array $containerRecord - */ public function __construct(array $childRecord, array $containerRecord) { $this->childRecord = $childRecord; @@ -47,33 +32,21 @@ public function __construct(array $childRecord, array $containerRecord) ' (page: ' . $containerRecord['pid'] . ' language: ' . $containerRecord['sys_language_uid'] . ')'; } - /** - * @return string - */ public function getErrorMessage(): string { return $this->errorMessage; } - /** - * @return int - */ public function getSeverity(): int { return ErrorInterface::ERROR; } - /** - * @return array - */ public function getChildRecord(): array { return $this->childRecord; } - /** - * @return array - */ public function getContainerRecord(): array { return $this->containerRecord; diff --git a/Classes/Integrity/Error/WrongLanguageWarning.php b/Classes/Integrity/Error/WrongLanguageWarning.php index 98ad3e42..c171db16 100644 --- a/Classes/Integrity/Error/WrongLanguageWarning.php +++ b/Classes/Integrity/Error/WrongLanguageWarning.php @@ -16,25 +16,10 @@ class WrongLanguageWarning implements ErrorInterface { private const IDENTIFIER = 'WrongLanguageWarning'; - /** - * @var array - */ - protected $childRecord; + protected array $childRecord; + protected array $containerRecord; + protected string $errorMessage; - /** - * @var array - */ - protected $containerRecord; - - /** - * @var string - */ - protected $errorMessage; - - /** - * @param array $childRecord - * @param array $containerRecord - */ public function __construct(array $childRecord, array $containerRecord) { $this->childRecord = $childRecord; @@ -46,33 +31,21 @@ public function __construct(array $childRecord, array $containerRecord) . ' has sys_language_uid ' . $containerRecord['sys_language_uid']; } - /** - * @return string - */ public function getErrorMessage(): string { return $this->errorMessage; } - /** - * @return int - */ public function getSeverity(): int { return ErrorInterface::WARNING; } - /** - * @return array - */ public function getChildRecord(): array { return $this->childRecord; } - /** - * @return array - */ public function getContainerRecord(): array { return $this->containerRecord; diff --git a/Classes/Integrity/Error/WrongParentError.php b/Classes/Integrity/Error/WrongParentError.php index 40002fa4..c9443e90 100644 --- a/Classes/Integrity/Error/WrongParentError.php +++ b/Classes/Integrity/Error/WrongParentError.php @@ -16,19 +16,9 @@ class WrongParentError implements ErrorInterface { private const IDENTIFIER = 'WrongParentError'; - /** - * @var array - */ - protected $containerRecord; - - /** - * @var string - */ - protected $errorMessage; - - /** - * @param array $containerRecord - */ + protected array $containerRecord; + protected string $errorMessage; + public function __construct(array $containerRecord) { $this->containerRecord = $containerRecord; @@ -37,25 +27,16 @@ public function __construct(array $containerRecord) ' has tx_container_parent ' . $containerRecord['tx_container_parent']; } - /** - * @return string - */ public function getErrorMessage(): string { return $this->errorMessage; } - /** - * @return int - */ public function getSeverity(): int { return ErrorInterface::ERROR; } - /** - * @return array - */ public function getContainerRecord(): array { return $this->containerRecord; diff --git a/Classes/Integrity/Error/WrongPidError.php b/Classes/Integrity/Error/WrongPidError.php index 27c78fdf..2ceb7c54 100644 --- a/Classes/Integrity/Error/WrongPidError.php +++ b/Classes/Integrity/Error/WrongPidError.php @@ -16,25 +16,10 @@ class WrongPidError implements ErrorInterface { private const IDENTIFIER = 'WrongPidError'; - /** - * @var array - */ - protected $childRecord; + protected array $childRecord; + protected array $containerRecord; + protected string $errorMessage; - /** - * @var array - */ - protected $containerRecord; - - /** - * @var string - */ - protected $errorMessage; - - /** - * @param array $childRecord - * @param array $containerRecord - */ public function __construct(array $childRecord, array $containerRecord) { $this->childRecord = $childRecord; @@ -45,33 +30,21 @@ public function __construct(array $childRecord, array $containerRecord) ' has pid ' . $containerRecord['pid'] . ' language: ' . $containerRecord['sys_language_uid'] . ')'; } - /** - * @return string - */ public function getErrorMessage(): string { return $this->errorMessage; } - /** - * @return int - */ public function getSeverity(): int { return ErrorInterface::ERROR; } - /** - * @return array - */ public function getChildRecord(): array { return $this->childRecord; } - /** - * @return array - */ public function getContainerRecord(): array { return $this->containerRecord; diff --git a/Classes/Integrity/Integrity.php b/Classes/Integrity/Integrity.php index b8dd60ce..b25fa6c8 100644 --- a/Classes/Integrity/Integrity.php +++ b/Classes/Integrity/Integrity.php @@ -20,20 +20,9 @@ use B13\Container\Integrity\Error\WrongParentError; use B13\Container\Integrity\Error\WrongPidError; use B13\Container\Tca\Registry; -use TYPO3\CMS\Core\SingletonInterface; -class Integrity implements SingletonInterface +class Integrity { - /** - * @var Database - */ - protected $database; - - /** - * @var Registry - */ - protected $tcaRegistry; - /** * @var string[][] */ @@ -42,10 +31,8 @@ class Integrity implements SingletonInterface 'warnings' => [], ]; - public function __construct(Database $database, Registry $tcaRegistry) + public function __construct(protected Database $database, protected Registry $tcaRegistry) { - $this->database = $database; - $this->tcaRegistry = $tcaRegistry; } public function run(): array diff --git a/Classes/Integrity/IntegrityFix.php b/Classes/Integrity/IntegrityFix.php index 1b94964d..91a28bf7 100644 --- a/Classes/Integrity/IntegrityFix.php +++ b/Classes/Integrity/IntegrityFix.php @@ -20,25 +20,12 @@ use B13\Container\Tca\Registry; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\DataHandling\DataHandler; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -class IntegrityFix implements SingletonInterface +class IntegrityFix { - /** - * @var Database - */ - protected $database; - - /** - * @var Registry - */ - protected $tcaRegistry; - - public function __construct(Database $database, Registry $tcaRegistry) + public function __construct(protected Database $database, protected Registry $tcaRegistry) { - $this->database = $database; - $this->tcaRegistry = $tcaRegistry; } public function deleteChildrenWithWrongPid(WrongPidError $wrongPidError): void diff --git a/Classes/Integrity/Sorting.php b/Classes/Integrity/Sorting.php index a9a34964..2af5e240 100644 --- a/Classes/Integrity/Sorting.php +++ b/Classes/Integrity/Sorting.php @@ -18,39 +18,18 @@ use B13\Container\Domain\Service\ContainerService; use B13\Container\Tca\Registry; use TYPO3\CMS\Core\DataHandling\DataHandler; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -class Sorting implements SingletonInterface +class Sorting { - /** - * @var Database - */ - protected $database; - - /** - * @var Registry - */ - protected $tcaRegistry; - - /** - * @var ContainerFactory - */ - protected $containerFactory; - - /** - * @var ContainerService - */ - protected $containerService; - - protected $errors = []; - - public function __construct(Database $database, Registry $tcaRegistry, ContainerFactory $containerFactory, ContainerService $containerService) - { - $this->database = $database; - $this->tcaRegistry = $tcaRegistry; - $this->containerFactory = $containerFactory; - $this->containerService = $containerService; + protected array $errors = []; + + public function __construct( + protected Database $database, + protected Registry $tcaRegistry, + protected ContainerFactory $containerFactory, + protected ContainerService $containerService + ) { } public function run(bool $dryRun = true, bool $enableLogging = false, ?int $pid = null): array diff --git a/Classes/Integrity/SortingInPage.php b/Classes/Integrity/SortingInPage.php index efa98d10..890ef6c6 100644 --- a/Classes/Integrity/SortingInPage.php +++ b/Classes/Integrity/SortingInPage.php @@ -17,39 +17,18 @@ use B13\Container\Domain\Service\ContainerService; use B13\Container\Tca\Registry; use TYPO3\CMS\Core\DataHandling\DataHandler; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -class SortingInPage implements SingletonInterface +class SortingInPage { - /** - * @var Database - */ - protected $database; + protected array $errors = []; - /** - * @var Registry - */ - protected $tcaRegistry; - - /** - * @var ContainerFactory - */ - protected $containerFactory; - - /** - * @var ContainerService - */ - protected $containerService; - - protected $errors = []; - - public function __construct(Database $database, Registry $tcaRegistry, ContainerFactory $containerFactory, ContainerService $containerService) - { - $this->database = $database; - $this->tcaRegistry = $tcaRegistry; - $this->containerFactory = $containerFactory; - $this->containerService = $containerService; + public function __construct( + protected Database $database, + protected Registry $tcaRegistry, + protected ContainerFactory $containerFactory, + protected ContainerService $containerService + ) { } public function run(bool $dryRun = true, bool $enableLogging = false, ?int $pid = null): array diff --git a/Classes/Listener/BootCompleted.php b/Classes/Listener/BootCompleted.php index cccbe38f..13b654f7 100644 --- a/Classes/Listener/BootCompleted.php +++ b/Classes/Listener/BootCompleted.php @@ -13,22 +13,19 @@ */ use B13\Container\Tca\Registry; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Core\Event\BootCompletedEvent; +use TYPO3\CMS\Core\Imaging\IconRegistry; +#[AsEventListener(identifier: 'tx-container-boot-completed')] class BootCompleted { - /** - * @var Registry - */ - protected $tcaRegistry; - - public function __construct(Registry $tcaRegistry) + public function __construct(protected Registry $tcaRegistry, protected IconRegistry $iconRegistry) { - $this->tcaRegistry = $tcaRegistry; } public function __invoke(BootCompletedEvent $event): void { - $this->tcaRegistry->registerIcons(); + $this->tcaRegistry->registerIcons($this->iconRegistry); } } diff --git a/Classes/Listener/ContentUsedOnPage.php b/Classes/Listener/ContentUsedOnPage.php index c5c32104..6692da7a 100644 --- a/Classes/Listener/ContentUsedOnPage.php +++ b/Classes/Listener/ContentUsedOnPage.php @@ -16,23 +16,13 @@ use B13\Container\Domain\Factory\PageView\Backend\ContainerFactory; use B13\Container\Tca\Registry; use TYPO3\CMS\Backend\View\Event\IsContentUsedOnPageLayoutEvent; +use TYPO3\CMS\Core\Attribute\AsEventListener; +#[AsEventListener(identifier: 'tx-container-content-used-on-page')] class ContentUsedOnPage { - /** - * @var Registry - */ - protected $tcaRegistry; - - /** - * @var ContainerFactory - */ - protected $containerFactory; - - public function __construct(ContainerFactory $containerFactory, Registry $tcaRegistry) + public function __construct(protected ContainerFactory $containerFactory, protected Registry $tcaRegistry) { - $this->containerFactory = $containerFactory; - $this->tcaRegistry = $tcaRegistry; } public function __invoke(IsContentUsedOnPageLayoutEvent $event): void diff --git a/Classes/Listener/LegacyPageContentPreviewRendering.php b/Classes/Listener/LegacyPageContentPreviewRendering.php index d7fd0386..c507004a 100644 --- a/Classes/Listener/LegacyPageContentPreviewRendering.php +++ b/Classes/Listener/LegacyPageContentPreviewRendering.php @@ -15,17 +15,14 @@ use B13\Container\Backend\Preview\GridRenderer; use B13\Container\Tca\Registry; use TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Information\Typo3Version; +#[AsEventListener(identifier: 'tx-container-legacy-page-content-preview-rendering', before: 'typo3-backend/fluid-preview/content')] class LegacyPageContentPreviewRendering { - protected GridRenderer $gridRenderer; - protected Registry $tcaRegistry; - - public function __construct(GridRenderer $gridRenderer, Registry $tcaRegistry) + public function __construct(protected GridRenderer $gridRenderer, protected Registry $tcaRegistry) { - $this->gridRenderer = $gridRenderer; - $this->tcaRegistry = $tcaRegistry; } public function __invoke(PageContentPreviewRenderingEvent $event): void diff --git a/Classes/Listener/LegacyPageTsConfig.php b/Classes/Listener/LegacyPageTsConfig.php deleted file mode 100644 index 05215d6b..00000000 --- a/Classes/Listener/LegacyPageTsConfig.php +++ /dev/null @@ -1,41 +0,0 @@ -tcaRegistry = $tcaRegistry; - } - - public function __invoke(ModifyLoadedPageTsConfigEvent $event): void - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() !== 11) { - return; - } - $tsConfig = $event->getTsConfig(); - $tsConfig['default'] = trim($this->tcaRegistry->getPageTsString() . "\n" . ($tsConfig['default'] ?? '')); - $event->setTsConfig($tsConfig); - } -} diff --git a/Classes/Listener/ModifyNewContentElementWizardItems.php b/Classes/Listener/ModifyNewContentElementWizardItems.php index ba504173..3fdc26a5 100644 --- a/Classes/Listener/ModifyNewContentElementWizardItems.php +++ b/Classes/Listener/ModifyNewContentElementWizardItems.php @@ -13,10 +13,12 @@ */ use TYPO3\CMS\Backend\Controller\Event\ModifyNewContentElementWizardItemsEvent; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[AsEventListener(identifier: 'tx-container-new-content-element-wizard')] class ModifyNewContentElementWizardItems { public function __invoke(ModifyNewContentElementWizardItemsEvent $event): void diff --git a/Classes/Listener/PageContentPreviewRendering.php b/Classes/Listener/PageContentPreviewRendering.php index dd952333..08ae4032 100644 --- a/Classes/Listener/PageContentPreviewRendering.php +++ b/Classes/Listener/PageContentPreviewRendering.php @@ -16,18 +16,15 @@ use B13\Container\Domain\Core\RecordWithRenderedGrid; use B13\Container\Tca\Registry; use TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Domain\Record; use TYPO3\CMS\Core\Information\Typo3Version; +#[AsEventListener(identifier: 'tx-container-page-content-preview-rendering', before: 'typo3-backend/fluid-preview/content')] class PageContentPreviewRendering { - protected GridRenderer $gridRenderer; - protected Registry $tcaRegistry; - - public function __construct(GridRenderer $gridRenderer, Registry $tcaRegistry) + public function __construct(protected GridRenderer $gridRenderer, protected Registry $tcaRegistry) { - $this->gridRenderer = $gridRenderer; - $this->tcaRegistry = $tcaRegistry; } public function __invoke(PageContentPreviewRenderingEvent $event): void diff --git a/Classes/Listener/PageTsConfig.php b/Classes/Listener/PageTsConfig.php index 8c328d64..b00f72cb 100644 --- a/Classes/Listener/PageTsConfig.php +++ b/Classes/Listener/PageTsConfig.php @@ -13,27 +13,18 @@ */ use B13\Container\Tca\Registry; -use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\TypoScript\IncludeTree\Event\ModifyLoadedPageTsConfigEvent; -use TYPO3\CMS\Core\Utility\GeneralUtility; +#[AsEventListener(identifier: 'tx-container-page-ts-config')] class PageTsConfig { - /** - * @var Registry - */ - protected $tcaRegistry; - - public function __construct(Registry $tcaRegistry) + public function __construct(protected Registry $tcaRegistry) { - $this->tcaRegistry = $tcaRegistry; } public function __invoke(ModifyLoadedPageTsConfigEvent $event): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - return; - } $tsConfig = $event->getTsConfig(); $tsConfig = array_merge(['pagesTsConfig-package-container' => $this->tcaRegistry->getPageTsString()], $tsConfig); $event->setTsConfig($tsConfig); diff --git a/Classes/Listener/RecordSummaryForLocalization.php b/Classes/Listener/RecordSummaryForLocalization.php index d75236bf..3c715269 100644 --- a/Classes/Listener/RecordSummaryForLocalization.php +++ b/Classes/Listener/RecordSummaryForLocalization.php @@ -14,25 +14,18 @@ use B13\Container\Service\RecordLocalizeSummaryModifier; use TYPO3\CMS\Backend\Controller\Event\AfterRecordSummaryForLocalizationEvent; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Information\Typo3Version; +#[AsEventListener(identifier: 'tx-container-record-summary-for-localization')] class RecordSummaryForLocalization { - /** - * @var RecordLocalizeSummaryModifier - */ - protected $recordLocalizeSummaryModifier; - - protected ConnectionPool $connectionPool; - public function __construct( - RecordLocalizeSummaryModifier $recordLocalizeSummaryModifier, - ConnectionPool $connectionPool + protected RecordLocalizeSummaryModifier $recordLocalizeSummaryModifier, + protected ConnectionPool $connectionPool ) { - $this->recordLocalizeSummaryModifier = $recordLocalizeSummaryModifier; - $this->connectionPool = $connectionPool; } public function __invoke(AfterRecordSummaryForLocalizationEvent $event): void diff --git a/Classes/Service/RecordLocalizeSummaryModifier.php b/Classes/Service/RecordLocalizeSummaryModifier.php index 26f0166e..4c3d3ea8 100644 --- a/Classes/Service/RecordLocalizeSummaryModifier.php +++ b/Classes/Service/RecordLocalizeSummaryModifier.php @@ -17,19 +17,12 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -class RecordLocalizeSummaryModifier implements SingletonInterface +class RecordLocalizeSummaryModifier { - /** - * @var Registry - */ - protected $containerRegistry; - - public function __construct(Registry $containerRegistry) + public function __construct(protected Registry $containerRegistry) { - $this->containerRegistry = $containerRegistry; } public function rebuildPayload(array $payload): array diff --git a/Classes/Tca/ContainerConfiguration.php b/Classes/Tca/ContainerConfiguration.php index 724ad40b..d62f4909 100644 --- a/Classes/Tca/ContainerConfiguration.php +++ b/Classes/Tca/ContainerConfiguration.php @@ -12,82 +12,26 @@ * of the License, or any later version. */ -use TYPO3\CMS\Core\Information\Typo3Version; -use TYPO3\CMS\Core\Utility\GeneralUtility; - class ContainerConfiguration { - /** - * @var string - */ - protected $cType = ''; - - /** - * @var string - */ - protected $label = ''; - - /** - * @var string - */ - protected $description = ''; - - /** - * @var mixed[] - */ - protected $grid = []; - - /** - * @var string - */ - protected $icon = 'EXT:container/Resources/Public/Icons/Extension.svg'; - + protected string $cType = ''; + protected string $label = ''; + protected string $description = ''; + protected array $grid = []; + protected string $icon = 'EXT:container/Resources/Public/Icons/Extension.svg'; protected string $backendTemplate = 'EXT:container/Resources/Private/Templates/Container.html'; - - /** - * @var string - */ - protected $gridTemplate = 'EXT:container/Resources/Private/Templates/Grid.html'; - - /** - * @var array - */ - protected $gridPartialPaths = [ + protected string $gridTemplate = 'EXT:container/Resources/Private/Templates/Grid.html'; + protected array $gridPartialPaths = [ 'EXT:backend/Resources/Private/Partials/', 'EXT:container/Resources/Private/Partials/', ]; - - protected $gridLayoutPaths = []; - - /** - * @var bool - */ - protected $saveAndCloseInNewContentElementWizard = true; - - /** - * @var bool - */ - protected $registerInNewContentElementWizard = true; - - /** - * @var string - */ - protected $group = 'container'; - - /** - * @var string - */ - protected $relativeToField = ''; - - /** - * @var string - */ - protected $relativePosition = ''; - - /** - * @var array - */ - protected $defaultValues = []; + protected array $gridLayoutPaths = []; + protected bool $saveAndCloseInNewContentElementWizard = true; + protected bool $registerInNewContentElementWizard = true; + protected string $group = 'container'; + protected string $relativeToField = ''; + protected string $relativePosition = ''; + protected array $defaultValues = []; public function __construct( string $cType, @@ -99,63 +43,32 @@ public function __construct( $this->label = $label; $this->description = $description; $this->grid = $grid; - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 11) { - $this->gridPartialPaths = [ - 'EXT:backend/Resources/Private/Partials/', - 'EXT:container/Resources/Private/Partials11/', - ]; - } elseif ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 12) { - $this->gridPartialPaths = [ - 'EXT:backend/Resources/Private/Partials/', - 'EXT:container/Resources/Private/Partials12/', - ]; - } } - /** - * @param string $icon - * @return ContainerConfiguration - */ public function setIcon(string $icon): ContainerConfiguration { $this->icon = $icon; return $this; } - /** - * @param string $backendTemplate - * @return ContainerConfiguration - */ public function setBackendTemplate(string $backendTemplate): ContainerConfiguration { $this->backendTemplate = $backendTemplate; return $this; } - /** - * @param string $gridTemplate - * @return ContainerConfiguration - */ public function setGridTemplate(string $gridTemplate): ContainerConfiguration { $this->gridTemplate = $gridTemplate; return $this; } - /** - * @param array $gridPartialPaths - * @return ContainerConfiguration - */ public function setGridPartialPaths(array $gridPartialPaths): ContainerConfiguration { $this->gridPartialPaths = $gridPartialPaths; return $this; } - /** - * @param string $gridPartialPath - * @return ContainerConfiguration - */ public function addGridPartialPath(string $gridPartialPath): ContainerConfiguration { $this->gridPartialPaths[] = $gridPartialPath; @@ -179,75 +92,46 @@ public function addGridLayoutPath(string $gridLayoutPath): ContainerConfiguratio return $this; } - /** - * @param bool $saveAndCloseInNewContentElementWizard - * @return ContainerConfiguration - */ public function setSaveAndCloseInNewContentElementWizard(bool $saveAndCloseInNewContentElementWizard): ContainerConfiguration { $this->saveAndCloseInNewContentElementWizard = $saveAndCloseInNewContentElementWizard; return $this; } - /** - * @param bool $registerInNewContentElementWizard - * @return ContainerConfiguration - */ public function setRegisterInNewContentElementWizard(bool $registerInNewContentElementWizard): ContainerConfiguration { $this->registerInNewContentElementWizard = $registerInNewContentElementWizard; return $this; } - /** - * @param string $group - * @return ContainerConfiguration - */ public function setGroup(string $group): ContainerConfiguration { $this->group = $group; return $this; } - /** - * @param string $relativeToField - * @return ContainerConfiguration - */ public function setRelativeToField(string $relativeToField): ContainerConfiguration { $this->relativeToField = $relativeToField; return $this; } - /** - * @param string $relativePosition - * @return ContainerConfiguration - */ public function setRelativePosition(string $relativePosition): ContainerConfiguration { $this->relativePosition = $relativePosition; return $this; } - /** - * @return string - */ public function getCType(): string { return $this->cType; } - /** - * @return string - */ public function getLabel(): string { return $this->label; } - /** - * @return mixed[] - */ public function getGrid(): array { return $this->grid; @@ -291,34 +175,21 @@ public function getSaveAndCloseInNewContentElementWizard(): bool return $this->saveAndCloseInNewContentElementWizard; } - /** - * @return string - */ public function getGroup(): string { return $this->group; } - /** - * @return string - */ public function getRelativeToField(): string { return $this->relativeToField; } - /** - * @return string - */ public function getRelativePosition(): string { return $this->relativePosition; } - /** - * @param array $defaultValues - * @return ContainerConfiguration - */ public function setDefaultValues(array $defaultValues): ContainerConfiguration { $this->defaultValues = $defaultValues; @@ -362,9 +233,6 @@ public function changeGridColumnConfiguration(int $colPos, array $override): voi $this->grid = $modRows; } - /** - * @return mixed[] - */ public function toArray(): array { return [ diff --git a/Classes/Tca/ItemProcFunc.php b/Classes/Tca/ItemProcFunc.php index da25f25f..12dae916 100644 --- a/Classes/Tca/ItemProcFunc.php +++ b/Classes/Tca/ItemProcFunc.php @@ -14,30 +14,17 @@ use B13\Container\Domain\Factory\ContainerFactory; use B13\Container\Domain\Factory\Exception; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Backend\View\BackendLayoutView; +#[Autoconfigure(public: true)] class ItemProcFunc { - /** - * @var ContainerFactory - */ - protected $containerFactory; - - /** - * @var BackendLayoutView - */ - protected $backendLayoutView; - - /** - * @var Registry - */ - protected $tcaRegistry; - - public function __construct(ContainerFactory $containerFactory, Registry $tcaRegistry, BackendLayoutView $backendLayoutView) - { - $this->containerFactory = $containerFactory; - $this->tcaRegistry = $tcaRegistry; - $this->backendLayoutView = $backendLayoutView; + public function __construct( + protected ContainerFactory $containerFactory, + protected Registry $tcaRegistry, + protected BackendLayoutView $backendLayoutView + ) { } /** @@ -60,8 +47,8 @@ public function colPos(array &$parameters): void // only one item is show, so it is not changeable if ((int)$column['colPos'] === (int)$row['colPos']) { $items[] = [ - $column['name'], - $column['colPos'], + 'label' => $column['name'], + 'value' => $column['colPos'], ]; } } @@ -85,19 +72,19 @@ public function txContainerParent(array &$parameters): void $container = $this->containerFactory->buildContainer((int)$row['tx_container_parent']); $cType = $container->getCType(); $items[] = [ - $this->tcaRegistry->getContainerLabel($cType), - $row['tx_container_parent'], + 'label' => $this->tcaRegistry->getContainerLabel($cType), + 'value' => $row['tx_container_parent'], ]; } catch (Exception $e) { $items[] = [ - '-', - 0, + 'label' => '-', + 'value' => 0, ]; } } else { $items[] = [ - '-', - 0, + 'label' => '-', + 'value' => 0, ]; } $parameters['items'] = $items; diff --git a/Classes/Tca/Registry.php b/Classes/Tca/Registry.php index 41262a8a..7d2af1c5 100644 --- a/Classes/Tca/Registry.php +++ b/Classes/Tca/Registry.php @@ -14,26 +14,20 @@ use B13\Container\Events\BeforeContainerConfigurationIsAppliedEvent; use Psr\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider; use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider; use TYPO3\CMS\Core\Imaging\IconRegistry; -use TYPO3\CMS\Core\Information\Typo3Version; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; -class Registry implements SingletonInterface +#[Autoconfigure(public: true)] +class Registry { - protected EventDispatcherInterface $eventDispatcher; - - public function __construct(EventDispatcherInterface $eventDispatcher) + public function __construct(protected EventDispatcherInterface $eventDispatcher) { - $this->eventDispatcher = $eventDispatcher; } - /** - * @param ContainerConfiguration $containerConfiguration - */ public function configureContainer(ContainerConfiguration $containerConfiguration): void { $beforeContainerConfigurationIsAppliedEvent = new BeforeContainerConfigurationIsAppliedEvent($containerConfiguration); @@ -41,60 +35,34 @@ public function configureContainer(ContainerConfiguration $containerConfiguratio if ($beforeContainerConfigurationIsAppliedEvent->shouldBeSkipped()) { return; } - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - ExtensionManagementUtility::addTcaSelectItem( - 'tt_content', - 'CType', - [ - 'label' => $containerConfiguration->getLabel(), - 'value' => $containerConfiguration->getCType(), - 'icon' => $containerConfiguration->getCType(), - 'group' => $containerConfiguration->getGroup(), - 'description' => $containerConfiguration->getDescription(), - ], - $containerConfiguration->getRelativeToField(), - $containerConfiguration->getRelativePosition(), - ); - } else { - ExtensionManagementUtility::addTcaSelectItem( - 'tt_content', - 'CType', - [ - $containerConfiguration->getLabel(), - $containerConfiguration->getCType(), - $containerConfiguration->getCType(), - $containerConfiguration->getGroup(), - ], - $containerConfiguration->getRelativeToField(), - $containerConfiguration->getRelativePosition(), - ); - } - $GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['previewRenderer'] = \B13\Container\Backend\Preview\ContainerPreviewRenderer::class; - - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 13) { - if (!isset($GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['creationOptions'])) { - $GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['creationOptions'] = []; - } - $GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['creationOptions']['saveAndClose'] = - $containerConfiguration->getSaveAndCloseInNewContentElementWizard(); - if ($containerConfiguration->getDefaultValues() !== []) { - $GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['creationOptions']['defaultValues'] = - $containerConfiguration->getDefaultValues(); - } + ExtensionManagementUtility::addTcaSelectItem( + 'tt_content', + 'CType', + [ + 'label' => $containerConfiguration->getLabel(), + 'value' => $containerConfiguration->getCType(), + 'icon' => $containerConfiguration->getCType(), + 'group' => $containerConfiguration->getGroup(), + 'description' => $containerConfiguration->getDescription(), + ], + $containerConfiguration->getRelativeToField(), + $containerConfiguration->getRelativePosition(), + ); + if (!isset($GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['creationOptions'])) { + $GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['creationOptions'] = []; + } + $GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['creationOptions']['saveAndClose'] = + $containerConfiguration->getSaveAndCloseInNewContentElementWizard(); + if ($containerConfiguration->getDefaultValues() !== []) { + $GLOBALS['TCA']['tt_content']['types'][$containerConfiguration->getCType()]['creationOptions']['defaultValues'] = + $containerConfiguration->getDefaultValues(); } foreach ($containerConfiguration->getGrid() as $row) { foreach ($row as $column) { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - $GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'][] = [ - 'label' => $column['name'], - 'value' => $column['colPos'], - ]; - } else { - $GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'][] = [ - $column['name'], - $column['colPos'], - ]; - } + $GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'][] = [ + 'label' => $column['name'], + 'value' => $column['colPos'], + ]; } } @@ -138,6 +106,15 @@ public function getContentDefenderConfiguration(string $cType, int $colPos): arr return $contentDefenderConfiguration; } + public function getAllowedCTypesInColumn(string $cType, int $colPos): ?array + { + $contentDefenderConfiguration = $this->getContentDefenderConfiguration($cType, $colPos); + if (empty($contentDefenderConfiguration['allowed.']['CType'])) { + return null; + } + return GeneralUtility::trimExplode(',', $contentDefenderConfiguration['allowed.']['CType'] ?? '', true); + } + public function getAllAvailableColumnsColPos(string $cType): array { $columns = $this->getAvailableColumns($cType); @@ -148,10 +125,9 @@ public function getAllAvailableColumnsColPos(string $cType): array return $availableColumnsColPos; } - public function registerIcons(): void + public function registerIcons(IconRegistry $iconRegistry): void { if (isset($GLOBALS['TCA']['tt_content']['containerConfiguration']) && is_array($GLOBALS['TCA']['tt_content']['containerConfiguration'])) { - $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); foreach ($GLOBALS['TCA']['tt_content']['containerConfiguration'] as $containerConfiguration) { if (file_exists(GeneralUtility::getFileAbsFileName($containerConfiguration['icon']))) { $provider = BitmapIconProvider::class; @@ -219,19 +195,6 @@ public function getContainerLabel(string $cType): string return $GLOBALS['TCA']['tt_content']['containerConfiguration'][$cType]['label'] ?? $cType; } - public function getColPosName(string $cType, int $colPos): ?string - { - $grid = $this->getGrid($cType); - foreach ($grid as $row) { - foreach ($row as $column) { - if ($column['colPos'] === $colPos) { - return (string)$column['name']; - } - } - } - return null; - } - public function getAvailableColumns(string $cType): array { $columns = []; @@ -267,72 +230,22 @@ public function getPageTsString(): string return ''; } $pageTs = ''; - // group containers by group - $groupedByGroup = []; $defaultGroup = 'container'; - - $typo3Version = GeneralUtility::makeInstance(Typo3Version::class); $cTypesExcludedInNewContentElementWizard = []; - foreach ($GLOBALS['TCA']['tt_content']['containerConfiguration'] as $cType => $containerConfiguration) { - if ($containerConfiguration['registerInNewContentElementWizard'] === true) { - $group = $containerConfiguration['group'] !== '' ? $containerConfiguration['group'] : $defaultGroup; - if (empty($groupedByGroup[$group])) { - $groupedByGroup[$group] = []; - } - $groupedByGroup[$group][$cType] = $containerConfiguration; - } - $pageTs .= LF . 'mod.web_layout.tt_content.preview { + $pageTs .= chr(10) . 'mod.web_layout.tt_content.preview { ' . $cType . ' = ' . $containerConfiguration['backendTemplate'] . ' } '; // s. https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-102834-RemoveItemsFromNewContentElementWizard.html - if ($typo3Version->getMajorVersion() > 12) { - if ($containerConfiguration['registerInNewContentElementWizard'] === false) { - $group = $containerConfiguration['group'] !== '' ? $containerConfiguration['group'] : $defaultGroup; - $cTypesExcludedInNewContentElementWizard[$group][] = $cType; - } - } - } - - if ($typo3Version->getMajorVersion() > 12) { - foreach ($cTypesExcludedInNewContentElementWizard as $group => $ctypes) { - $pageTs .= LF . 'mod.wizards.newContentElement.wizardItems.' . $group . '.removeItems := addToList(' . implode(',', $ctypes) . ')'; + if ($containerConfiguration['registerInNewContentElementWizard'] === false) { + $group = $containerConfiguration['group'] !== '' ? $containerConfiguration['group'] : $defaultGroup; + $cTypesExcludedInNewContentElementWizard[$group][] = $cType; } - return $pageTs; } - foreach ($groupedByGroup as $group => $containerConfigurations) { - $groupLabel = $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemGroups'][$group] ?? $group; - - $content = ''; - if (!in_array($group, ['common', 'default', 'menu', 'special', 'forms', 'plugins'])) { - // do not override EXT:backend dummy placeholders for item groups - $content .= ' -mod.wizards.newContentElement.wizardItems.' . $group . '.header = ' . $groupLabel . ' -'; - } - foreach ($containerConfigurations as $cType => $containerConfiguration) { - array_walk($containerConfiguration['defaultValues'], static function (&$item, $key) { - $item = $key . ' = ' . $item; - }); - $ttContentDefValues = 'CType = ' . $cType . LF . implode(LF, $containerConfiguration['defaultValues']); - $content .= 'mod.wizards.newContentElement.wizardItems.' . ($group === 'default' ? 'common' : $group) . '.show := addToList(' . $cType . ') -'; - $content .= 'mod.wizards.newContentElement.wizardItems.' . ($group === 'default' ? 'common' : $group) . '.elements { -' . $cType . ' { - title = ' . $containerConfiguration['label'] . ' - description = ' . $containerConfiguration['description'] . ' - iconIdentifier = ' . $cType . ' - tt_content_defValues { - ' . $ttContentDefValues . ' - } - saveAndClose = ' . $containerConfiguration['saveAndCloseInNewContentElementWizard'] . ' -} -} -'; - } - $pageTs .= LF . $content; + foreach ($cTypesExcludedInNewContentElementWizard as $group => $ctypes) { + $pageTs .= chr(10) . 'mod.wizards.newContentElement.wizardItems.' . $group . '.removeItems := addToList(' . implode(',', $ctypes) . ')'; } return $pageTs; } diff --git a/Classes/Updates/ContainerDeleteChildrenWithWrongPid.php b/Classes/Updates/ContainerDeleteChildrenWithWrongPid.php deleted file mode 100644 index 969e7e0b..00000000 --- a/Classes/Updates/ContainerDeleteChildrenWithWrongPid.php +++ /dev/null @@ -1,128 +0,0 @@ -integrity = $integrity; - $this->integrityFix = $integrityFix; - } - - public function setOutput(OutputInterface $output): void - { - $this->output = $output; - } - - public function getIdentifier(): string - { - return self::IDENTIFIER; - } - - /** - * @return string Title of this updater - */ - public function getTitle(): string - { - return 'EXT:container: Delete "container" children with wrong pid'; - } - - /** - * @return string Longer description of this updater - */ - public function getDescription(): string - { - return 'if you update from Version < 1.3 you may have children with wrong pid and they was never shown in BE/FE'; - } - - public function updateNecessary(): bool - { - $res = $this->integrity->run(); - foreach ($res['errors'] as $error) { - if ($error instanceof WrongPidError) { - return true; - } - } - return false; - } - - public function executeUpdate(): bool - { - if (Environment::isCli() === false) { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 11) { - $requestFactory = GeneralUtility::makeInstance(ServerRequestFactory::class); - $request = $requestFactory::fromGlobals(); - $request = $request->withAttribute('normalizedParams', NormalizedParams::createFromRequest($request)); - Bootstrap::initializeBackendUser(BackendUserAuthentication::class, $request); - } else { - Bootstrap::initializeBackendUser(); - } - if ($GLOBALS['BE_USER'] === null || $GLOBALS['BE_USER']->user === null) { - $this->output->writeln( - 'EXT:container Migrations need a valid Backend User, Login to the Backend to execute Wizard, or use CLI' - ); - return false; - } - Bootstrap::initializeBackendAuthentication(); - $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->createFromUserPreferences($GLOBALS['BE_USER']); - } - $res = $this->integrity->run(); - foreach ($res['errors'] as $error) { - if ($error instanceof WrongPidError) { - $this->integrityFix->deleteChildrenWithWrongPid($error); - } - } - return true; - } - - public function getPrerequisites(): array - { - return [ - DatabaseUpdatedPrerequisite::class, - ]; - } -} diff --git a/Classes/Updates/ContainerMigrateSorting.php b/Classes/Updates/ContainerMigrateSorting.php index 652b0404..1477fa2c 100644 --- a/Classes/Updates/ContainerMigrateSorting.php +++ b/Classes/Updates/ContainerMigrateSorting.php @@ -14,12 +14,12 @@ use B13\Container\Integrity\Sorting; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequestFactory; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Install\Attribute\UpgradeWizard; @@ -29,20 +29,15 @@ use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; #[UpgradeWizard('container_containerMigrateSorting')] +#[Autoconfigure(public: true)] class ContainerMigrateSorting implements UpgradeWizardInterface, RepeatableInterface, ChattyInterface { public const IDENTIFIER = 'container_migratesorting'; private OutputInterface $output; - /** - * @var Sorting - */ - protected $sorting; - - public function __construct(Sorting $sorting) + public function __construct(protected Sorting $sorting) { - $this->sorting = $sorting; } public function setOutput(OutputInterface $output): void @@ -55,17 +50,11 @@ public function getIdentifier(): string return self::IDENTIFIER; } - /** - * @return string Title of this updater - */ public function getTitle(): string { return 'EXT:container: Migrate "container" sorting'; } - /** - * @return string Longer description of this updater - */ public function getDescription(): string { return 'change sorting of container children (must be run multiple times for nested containers)'; @@ -80,14 +69,10 @@ public function updateNecessary(): bool public function executeUpdate(): bool { if (Environment::isCli() === false) { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 11) { - $requestFactory = GeneralUtility::makeInstance(ServerRequestFactory::class); - $request = $requestFactory::fromGlobals(); - $request = $request->withAttribute('normalizedParams', NormalizedParams::createFromRequest($request)); - Bootstrap::initializeBackendUser(BackendUserAuthentication::class, $request); - } else { - Bootstrap::initializeBackendUser(); - } + $requestFactory = GeneralUtility::makeInstance(ServerRequestFactory::class); + $request = $requestFactory::fromGlobals(); + $request = $request->withAttribute('normalizedParams', NormalizedParams::createFromRequest($request)); + Bootstrap::initializeBackendUser(BackendUserAuthentication::class, $request); if ($GLOBALS['BE_USER'] === null || $GLOBALS['BE_USER']->user === null) { $this->output->writeln( 'EXT:container Migrations need a valid Backend User, Login to the Backend to execute Wizard, or use CLI' diff --git a/Classes/Xclasses/LocalizationController.php b/Classes/Xclasses/LocalizationController.php deleted file mode 100644 index bd12cf7b..00000000 --- a/Classes/Xclasses/LocalizationController.php +++ /dev/null @@ -1,41 +0,0 @@ -recordLocalizeSummaryModifier = $recordLocalizeSummaryModifier ?? GeneralUtility::makeInstance(RecordLocalizeSummaryModifier::class); - } - - public function getRecordLocalizeSummary(ServerRequestInterface $request): ResponseInterface - { - $response = parent::getRecordLocalizeSummary($request); - $payload = json_decode($response->getBody()->getContents(), true); - $payload = $this->recordLocalizeSummaryModifier->rebuildPayload($payload); - return new JsonResponse($payload); - } -} diff --git a/Configuration/JavaScriptModules.php b/Configuration/JavaScriptModules.php index 65264ac9..cbed52de 100644 --- a/Configuration/JavaScriptModules.php +++ b/Configuration/JavaScriptModules.php @@ -1,13 +1,5 @@ getMajorVersion() < 13) { - return [ - 'imports' => [ - '@typo3/backend/layout-module/drag-drop.js' => 'EXT:container/Resources/Public/JavaScript/Overrides12/drag-drop.js', - '@typo3/backend/layout-module/paste.js' => 'EXT:container/Resources/Public/JavaScript/Overrides12/paste.js', - ], - ]; -} return [ 'imports' => [ '@typo3/backend/layout-module/drag-drop.js' => 'EXT:container/Resources/Public/JavaScript/Overrides/drag-drop.js', diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index a6d455d2..bde54796 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -13,121 +13,7 @@ services: - '../Classes/Tca/ContainerConfiguration.php' - '../Classes/**/Exception.php' - B13\Container\Tca\Registry: - public: true - B13\Container\Backend\Preview\GridRenderer: - arguments: - $runtimeCache: '@cache.runtime' - B13\Container\Backend\Preview\ContainerPreviewRenderer: - public: true - arguments: - $runtimeCache: '@cache.runtime' - B13\Container\Hooks\UsedRecords: - public: true - B13\Container\Hooks\Datahandler\CommandMapAfterFinishHook: - public: true - B13\Container\Hooks\Datahandler\CommandMapBeforeStartHook: - public: true - B13\Container\Hooks\Datahandler\CommandMapPostProcessingHook: - public: true - B13\Container\Hooks\Datahandler\DatamapBeforeStartHook: - public: true - B13\Container\Hooks\Datahandler\DatamapPreProcessFieldArrayHook: - public: true - B13\Container\Hooks\Datahandler\DeleteHook: - public: true - B13\Container\ContentDefender\Hooks\ColumnConfigurationManipulationHook: - public: true - B13\Container\DataProcessing\ContainerProcessor: - public: true - tags: - - { name: 'data.processor', identifier: 'container' } - B13\Container\Updates\ContainerMigrateSorting: - public: true - B13\Container\Updates\ContainerDeleteChildrenWithWrongPid: - public: true - B13\Container\Tca\ItemProcFunc: - public: true - B13\Container\Listener\RecordSummaryForLocalization: - tags: - - name: event.listener - identifier: 'tx-container-record-summary-for-localization' - B13\Container\Listener\ContentUsedOnPage: - tags: - - name: event.listener - identifier: 'tx-container-content-used-on-page' - B13\Container\Listener\ModifyNewContentElementWizardItems: - tags: - - name: event.listener - identifier: 'tx-container-new-content-element-wizard' - B13\Container\Listener\LegacyPageTsConfig: - tags: - - name: event.listener - identifier: 'tx-container-legacy-page-ts-config' - B13\Container\Listener\PageTsConfig: - tags: - - name: event.listener - identifier: 'tx-container-page-ts-config' - B13\Container\Listener\BootCompleted: - tags: - - name: event.listener - identifier: 'tx-container-boot-completed' - B13\Container\Listener\LegacyPageContentPreviewRendering: - tags: - - name: event.listener - identifier: 'tx-container-legacy-page-content-preview-rendering' - before: 'typo3-backend/fluid-preview/content' - B13\Container\Listener\PageContentPreviewRendering: - tags: - - name: event.listener - identifier: 'tx-container-page-content-preview-rendering' - before: 'typo3-backend/fluid-preview/content' - B13\Container\Command\FixLanguageModeCommand: - tags: - - name: 'console.command' - command: 'container:fixLanguageMode' - schedulable: false - description: connect children of connected container if possible, else disconnect container - B13\Container\Command\FixContainerParentForConnectedModeCommand: - tags: - - name: 'console.command' - command: 'container:fixContainerParentForConnectedMode' - schedulable: false - description: tx_container_parent of children in connected mode should point to default language container - B13\Container\Command\DeleteChildrenWithWrongPidCommand: - tags: - - name: 'console.command' - command: 'container:deleteChildrenWithWrongPid' - schedulable: false - description: delete all child records with pid neq containers pid - B13\Container\Command\DeleteChildrenWithNonExistingParentCommand: - tags: - - name: 'console.command' - command: 'container:deleteChildrenWithNonExistingParent' - schedulable: false - description: delete all child records with a non existing parent record (they are displayed as unsued) - B13\Container\Command\DeleteChildrenWithUnusedColPosCommand: - tags: - - name: 'console.command' - command: 'container:deleteChildrenWithUnusedColPos' - schedulable: false - description: delete all child records with a colPos that is not available for the parent CType (they are displayed as unsued) - B13\Container\Command\IntegrityCommand: - tags: - - name: 'console.command' - command: 'container:integrity' - schedulable: true - description: Checks integrity of containers - B13\Container\Command\SortingCommand: - tags: - - name: 'console.command' - command: 'container:sorting' - schedulable: false - description: Resort Content Elements - B13\Container\Command\SortingInPageCommand: + B13\Container\DataProcessing\ContainerProcessor: tags: - - name: 'console.command' - command: 'container:sorting-in-page' - schedulable: false - description: Resort Content Elements + - { name: 'data.processor', identifier: 'container' } \ No newline at end of file diff --git a/README.md b/README.md index 4de5178a..ed516aea 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ - No default containers; everything will be built the way it is needed for a project - Supports multilanguage (connected or free mode (mixed mode not supported)) - Supports workspaces -- Supports colPos-restrictions if EXT:content_defender >= 3.1.0 is installed +- Supports colPos-restrictions if EXT:content_defender is installed - Frontend Rendering via DataProcessor and Fluid templates ## Why did we create another "Grid" extension? @@ -83,11 +83,11 @@ This is an example of creating a two-column container. The code snippet goes int | `setDefaultValues` | Default values for the newContentElement.wizardItems | `array $defaultValues` | `[]` | __Notes:__ -- If EXT:content_defender >= 3.1.0 is installed, you can use `allowed`, `disallowed`, and `maxitems` in the column configuration +- If EXT:content_defender is installed, you can use `allowed`, `disallowed`, and `maxitems` in the column configuration - The container registry does multiple things: - Adds CType to TCA select items - Registers your icon - - Adds PageTSconfig for `newContentElement.wizardItems` + - Adds PageTSconfig - Sets ``showitem`` for this CType (`sys_language_uid,CType,tx_container_parent,colPos,hidden`) - Saves the configuration in TCA in ``$GLOBALS['TCA']['tt_content']['containerConfiguration'][]`` for further usage - We provide some default icons you can use; see `Resources/Public/Icons` @@ -181,7 +181,7 @@ Change view object, e.g., add variables to view or change paths ## Concepts - Complete registration is done with one PHP call to TCA Registry -- A container in the TYPO3 backend Page module is rendered like a page itself (see View/ContainerLayoutView) +- A container in the TYPO3 backend Page module is rendered like a page itself (see Backend/Preview/GridRenderer called in PageContentPreviewRenderingEvent Listeners) - For backend clipboard and drag & drop `_` used in the data-colpos attribute in the wrapping CE-div Element (instead of just the colPos as in the PageLayoutView) - The `_` parameter is resolved to `tx_container_parent` and `colPos` value in DataHandler hooks - When translating a container, all child elements also get translated (the child elements are not explicitly listed during the translation dialog) diff --git a/Resources/Private/Partials11/PageLayout/Grid/Column.html b/Resources/Private/Partials11/PageLayout/Grid/Column.html deleted file mode 100644 index 06a61e8f..00000000 --- a/Resources/Private/Partials11/PageLayout/Grid/Column.html +++ /dev/null @@ -1,84 +0,0 @@ - -remove class t3-grid-cell (for tests) -change data-colpos attr - -
- - -
- - - -
- {column.title} -
- - {column.title} ({column.titleUnassigned}) - - - {column.titleInaccessible} - - - {column.titleInaccessible} - -
-
- use column.allowNewContent instead of pageContext - - - - -
-
Empty Colpos
-
-
-
-
- This column has no "colPos". This is only for display Purposes. -
-
-
-
-
-
- - change data-colpos attr -
- - - - - -
-
- - diff --git a/Resources/Private/Partials11/PageLayout/Record.html b/Resources/Private/Partials11/PageLayout/Record.html deleted file mode 100644 index 028eb058..00000000 --- a/Resources/Private/Partials11/PageLayout/Record.html +++ /dev/null @@ -1,42 +0,0 @@ - -{f:if(condition: '{item.disabled} && {item.context.drawingConfiguration.showHidden} == 0', then: 'display: none;') -> f:variable(name: 'style')} -
-
- - - -
-
-
- -
-
- - - -
-
- use column.allowNewContent instead of pageContext - -
- - - - - - - - - - - - - - -
-
-
-
- diff --git a/Resources/Private/Partials12/PageLayout/Grid/Column.html b/Resources/Private/Partials12/PageLayout/Grid/Column.html deleted file mode 100644 index d9c99d50..00000000 --- a/Resources/Private/Partials12/PageLayout/Grid/Column.html +++ /dev/null @@ -1,36 +0,0 @@ - - Styling requires the colpos to be set to the string 'unused'. To preserve type safety in the - controller, the string is only used in the template by setting the below "colpos" variable. - - - - - - - - - - - - - - - - -
- - - -
-
- {column.afterSectionMarkup} - diff --git a/Resources/Private/Partials12/PageLayout/Grid/ColumnHeader.html b/Resources/Private/Partials12/PageLayout/Grid/ColumnHeader.html deleted file mode 100644 index 8cacf2df..00000000 --- a/Resources/Private/Partials12/PageLayout/Grid/ColumnHeader.html +++ /dev/null @@ -1,45 +0,0 @@ -
- - -
- - - - - -
- {column.title} -
- - - - - {column.titleUnassigned} - - - {column.titleInaccessible} - -
-
-{column.beforeSectionMarkup} - -
-
- - - - - - - - - - - - - - -
-
-
-
diff --git a/Resources/Private/Partials12/PageLayout/Record.html b/Resources/Private/Partials12/PageLayout/Record.html deleted file mode 100644 index c22a6bd5..00000000 --- a/Resources/Private/Partials12/PageLayout/Record.html +++ /dev/null @@ -1,50 +0,0 @@ -{f:if(condition: '{item.disabled} && {item.context.drawingConfiguration.showHidden} == 0', then: 'height: 0; display: none;') -> f:variable(name: 'style')} -
- id={item.record.uid} - {item.record.header} - {item.contentTypeLabel} -
- - - - -
- -
-
- - - - - - -
- -
- - - - - - - - - - - - - - -
-
-
-
diff --git a/Resources/Public/JavaScript/Overrides12/drag-drop.js b/Resources/Public/JavaScript/Overrides12/drag-drop.js deleted file mode 100644 index ea7c4d48..00000000 --- a/Resources/Public/JavaScript/Overrides12/drag-drop.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import interact from"interactjs";import DocumentService from"@typo3/core/document-service.js";import DataHandler from"@typo3/backend/ajax-data-handler.js";import Icons from"@typo3/backend/icons.js";import RegularEvent from"@typo3/core/event/regular-event.js";class DragDrop{constructor(){DocumentService.ready().then((()=>{DragDrop.initialize()}))}static initialize(){const e=document.querySelector(".module");new RegularEvent("wheel",(t=>{e.scrollLeft+=t.deltaX,e.scrollTop+=t.deltaY})).delegateTo(document,".draggable-dragging"),interact(DragDrop.draggableContentIdentifier).draggable({allowFrom:DragDrop.draggableContentHandleIdentifier,onstart:DragDrop.onDragStart,onmove:DragDrop.onDragMove,onend:DragDrop.onDragEnd}).pointerEvents({allowFrom:DragDrop.draggableContentHandleIdentifier}).on("move",(function(e){const t=e.interaction,a=e.currentTarget;if(t.pointerIsDown&&!t.interacting()&&"false"!=a.getAttribute("clone")){const r=a.cloneNode(!0);r.setAttribute("data-dragdrop-clone","true"),a.parentNode.insertBefore(r,a.nextSibling),t.start({name:"drag"},e.interactable,a)}})),interact(DragDrop.dropZoneIdentifier).dropzone({accept:this.draggableContentIdentifier,ondrop:DragDrop.onDrop,checker:(e,t,a,r,o)=>{const n=o.getBoundingClientRect();return t.pageX>=n.left&&t.pageX<=n.left+n.width&&t.pageY>=n.top&&t.pageY<=n.top+n.height}}).on("dragenter",(e=>{e.target.classList.add(DragDrop.dropPossibleHoverClass)})).on("dragleave",(e=>{e.target.classList.remove(DragDrop.dropPossibleHoverClass)}))}static onDragStart(e){e.target.dataset.dragStartX=(e.client.x-e.rect.left).toString(),e.target.dataset.dragStartY=(e.client.y-e.rect.top).toString(),e.target.style.width=getComputedStyle(e.target).getPropertyValue("width"),e.target.classList.add("draggable-dragging");const t=document.createElement("div");t.classList.add("draggable-copy-message"),t.textContent=TYPO3.lang["dragdrop.copy.message"],e.target.append(t),e.target.closest(DragDrop.columnIdentifier).classList.remove("active"),e.target.querySelector(DragDrop.dropZoneIdentifier).hidden=!0,document.querySelectorAll(DragDrop.dropZoneIdentifier).forEach((e=>{const t=e.parentElement.querySelector(DragDrop.addContentIdentifier);null!==t&&(t.hidden=!0,e.classList.add(DragDrop.validDropZoneClass))}))}static onDragMove(e){const t=document.querySelector(".module");e.target.style.left=e.client.x-parseInt(e.target.dataset.dragStartX,10)+"px",e.target.style.top=e.client.y-parseInt(e.target.dataset.dragStartY,10)+"px",e.delta.x<0&&e.pageX-20<0?t.scrollLeft-=20:e.delta.x>0&&e.pageX+20>t.offsetWidth&&(t.scrollLeft+=20),e.delta.y<0&&e.pageY-20-document.querySelector(".t3js-module-docheader").clientHeight<0?t.scrollTop-=20:e.delta.y>0&&e.pageY+20>t.offsetHeight&&(t.scrollTop+=20)}static onDragEnd(e){e.target.dataset.dragStartX="",e.target.dataset.dragStartY="",e.target.classList.remove("draggable-dragging"),e.target.style.width="unset",e.target.style.left="unset",e.target.style.top="unset",e.target.closest(DragDrop.columnIdentifier).classList.add("active"),e.target.querySelector(DragDrop.dropZoneIdentifier).hidden=!1,e.target.querySelector(".draggable-copy-message").remove(),document.querySelectorAll(DragDrop.dropZoneIdentifier+"."+DragDrop.validDropZoneClass).forEach((e=>{const t=e.parentElement.querySelector(DragDrop.addContentIdentifier);null!==t&&(t.hidden=!1),e.classList.remove(DragDrop.validDropZoneClass)})),document.querySelectorAll(DragDrop.draggableContentCloneIdentifier).forEach((e=>{e.remove()}))}static onDrop(e){const t=e.target,a=e.relatedTarget,r=DragDrop.getColumnPositionForElement(t),o=DragDrop.getTxContainerParentPositionForElement(t),n=parseInt(a.dataset.uid,10);if("number"==typeof n&&n>0){const s={},d=t.closest(DragDrop.contentIdentifier).dataset.uid;let l;l=void 0===d?parseInt(t.closest("[data-page]").dataset.page,10):0-parseInt(d,10);let g=parseInt(a.dataset.languageUid,10);-1!==g&&(g=parseInt(t.closest("[data-language-uid]").dataset.languageUid,10));let i=0,c=0;0!==l&&(i=r,c=o);const p=e.dragEvent.ctrlKey||t.classList.contains("t3js-paste-copy"),D=p?"copy":"move";s.cmd={tt_content:{[n]:{[D]:{action:"paste",target:l,update:{colPos:i,sys_language_uid:g,tx_container_parent:c}}}}},DragDrop.ajaxAction(t,a,s,p).then((()=>{const e=document.querySelector(`.t3-page-column-lang-name[data-language-uid="${g}"]`);if(null===e)return;const t=e.dataset.flagIdentifier,r=e.dataset.languageTitle;Icons.getIcon(t,Icons.sizes.small).then((e=>{const t=a.querySelector(".t3js-flag");t.title=r,t.innerHTML=e}))}))}}static ajaxAction(e,t,a,r){const o=Object.keys(a.cmd).shift(),n=parseInt(Object.keys(a.cmd[o]).shift(),10),s={component:"dragdrop",action:r?"copy":"move",table:o,uid:n},d=document.querySelector(".t3-grid-container");return DataHandler.process(a,s).then((a=>{if(a.hasErrors)throw a.messages;e.parentElement.classList.contains(DragDrop.contentIdentifier.substring(1))?e.closest(DragDrop.contentIdentifier).after(t):e.closest(DragDrop.dropZoneIdentifier).after(t),(r||"1"===d?.dataset.defaultLanguageBinding)&&self.location.reload()}))}static getColumnPositionForElement(e){const t=e.closest("[data-colpos]");return null!==t&&void 0!==t.dataset.colpos&&parseInt(t.dataset.colpos,10)}static getTxContainerParentPositionForElement(e){const t=e.closest("[data-tx-container-parent]");return null!==t&&void 0!==t.dataset.txContainerParent?parseInt(t.dataset.txContainerParent,10):0}}DragDrop.contentIdentifier=".t3js-page-ce",DragDrop.draggableContentIdentifier=".t3js-page-ce-sortable",DragDrop.draggableContentHandleIdentifier=".t3js-page-ce-draghandle",DragDrop.draggableContentCloneIdentifier="[data-dragdrop-clone]",DragDrop.dropZoneIdentifier=".t3js-page-ce-dropzone-available",DragDrop.columnIdentifier=".t3js-page-column",DragDrop.validDropZoneClass="active",DragDrop.dropPossibleHoverClass="t3-page-ce-dropzone-possible",DragDrop.addContentIdentifier=".t3js-page-new-ce";export default new DragDrop; \ No newline at end of file diff --git a/Resources/Public/JavaScript/Overrides12/paste.js b/Resources/Public/JavaScript/Overrides12/paste.js deleted file mode 100644 index 9e807eac..00000000 --- a/Resources/Public/JavaScript/Overrides12/paste.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"@typo3/core/document-service.js";import $ from"jquery";import DataHandler from"@typo3/backend/ajax-data-handler.js";import{default as Modal}from"@typo3/backend/modal.js";import Severity from"@typo3/backend/severity.js";import"@typo3/backend/element/icon-element.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";class Paste{constructor(t){this.itemOnClipboardUid=0,this.itemOnClipboardTitle="",this.copyMode="",this.elementIdentifier=".t3js-page-ce",this.pasteAfterLinkTemplate="",this.pasteIntoLinkTemplate="",this.itemOnClipboardUid=t.itemOnClipboardUid,this.itemOnClipboardTitle=t.itemOnClipboardTitle,this.copyMode=t.copyMode,DocumentService.ready().then((()=>{$(".t3js-page-columns").length&&(this.generateButtonTemplates(),this.activatePasteIcons(),this.initializeEvents())}))}static determineColumn(t){const e=t.closest("[data-colpos]");return e.length&&"undefined"!==e.data("colpos")?e.data("colpos"):0}static determineTxContainerParent(t){const e=t.closest("[data-tx-container-parent]");return e.length&&"undefined"!==e.data("txContainerParent")?e.data("txContainerParent"):0}initializeEvents(){$(document).on("click",".t3js-paste",(t=>{t.preventDefault(),this.activatePasteModal($(t.currentTarget))}))}generateButtonTemplates(){this.itemOnClipboardUid&&(this.pasteAfterLinkTemplate='',this.pasteIntoLinkTemplate='')}activatePasteIcons(){this.pasteAfterLinkTemplate&&this.pasteIntoLinkTemplate&&document.querySelectorAll(".t3js-page-new-ce").forEach((t=>{const e=t.parentElement.dataset.page?this.pasteIntoLinkTemplate:this.pasteAfterLinkTemplate;t.append(document.createRange().createContextualFragment(e))}))}activatePasteModal(t){const e=(TYPO3.lang["paste.modal.title.paste"]||"Paste record")+': "'+this.itemOnClipboardTitle+'"',a=TYPO3.lang["paste.modal.paste"]||"Do you want to paste the record to this position?";let n=[];n=[{text:TYPO3.lang["paste.modal.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",trigger:(t,e)=>e.hideModal()},{text:TYPO3.lang["paste.modal.button.paste"]||"Paste",btnClass:"btn-"+Severity.getCssClass(SeverityEnum.warning),trigger:(e,a)=>{a.hideModal(),this.execute(t)}}],Modal.show(e,a,SeverityEnum.warning,n)}execute(t){const e=Paste.determineColumn(t),a=Paste.determineTxContainerParent(t),n=t.closest(this.elementIdentifier),s=n.data("uid");let o;o=void 0===s?parseInt(n.data("page"),10):0-parseInt(s,10);const i={CB:{paste:"tt_content|"+o,pad:"normal",update:{colPos:e,sys_language_uid:parseInt(t.closest("[data-language-uid]").data("language-uid"),10),tx_container_parent:a}}};DataHandler.process(i).then((t=>{t.hasErrors||window.location.reload()}))}}export default Paste; \ No newline at end of file diff --git a/Tests/Acceptance/Backend/ContentDefenderCest.php b/Tests/Acceptance/Backend/ContentDefenderCest.php index 1eafa7ff..78995f21 100644 --- a/Tests/Acceptance/Backend/ContentDefenderCest.php +++ b/Tests/Acceptance/Backend/ContentDefenderCest.php @@ -14,32 +14,20 @@ use B13\Container\Tests\Acceptance\Support\BackendTester; use B13\Container\Tests\Acceptance\Support\PageTree; -use B13\Container\Tests\Acceptance\Support\PageTreeV13; -use TYPO3\CMS\Core\Information\Typo3Version; -use TYPO3\CMS\Core\Utility\GeneralUtility; +use Codeception\Attribute\Group; class ContentDefenderCest { - /** - * @param BackendTester $I - */ public function _before(BackendTester $I) { $I->loginAs('admin'); } - /** - * @group content_defender - */ - public function canCreateChildIn2ColsContainerWithNoContentDefenderRestrictionsDefined(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void + #[Group('content_defender')] + public function canCreateChildIn2ColsContainerWithNoContentDefenderRestrictionsDefined(BackendTester $I, PageTree $pageTree): void { $I->clickLayoutModuleButton(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithDifferentContainers']); - } else { - $pageTreeV13->openPath(['home', 'pageWithDifferentContainers']); - } + $pageTree->openPath(['home', 'pageWithDifferentContainers']); $I->wait(0.5); $I->switchToContentFrame(); $dataColPos = $I->getDataColPos(300, 200); @@ -47,26 +35,17 @@ public function canCreateChildIn2ColsContainerWithNoContentDefenderRestrictionsD $I->clickNewContentElement($colPosSelector); $I->switchToIFrame(); $I->waitForModal(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); - } + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); $I->waitForText('Header Only'); $I->see('Header Only'); $I->see('Images Only'); } - /** - * @group content_defender - */ - public function doNotSeeNotAllowedContentElementsInNewContentElementWizard(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void + #[Group('content_defender')] + public function doNotSeeNotAllowedContentElementsInNewContentElementWizard(BackendTester $I, PageTree $pageTree): void { $I->clickLayoutModuleButton(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithContainer-3']); - } else { - $pageTreeV13->openPath(['home', 'pageWithContainer-3']); - } + $pageTree->openPath(['home', 'pageWithContainer-3']); $I->wait(0.5); $I->switchToContentFrame(); $dataColPos = $I->getDataColPos(800, 200); @@ -74,79 +53,38 @@ public function doNotSeeNotAllowedContentElementsInNewContentElementWizard(Backe $I->clickNewContentElement($colPosSelector); $I->switchToIFrame(); $I->waitForModal(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); - } + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); $I->waitForText('Header Only'); $I->dontSee('Images Only'); } - /** - * @group content_defender - */ - public function doNotSeeNotAllowedContentElementsInNewContentElementWizardTriggeredByContextMenu(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void + #[Group('content_defender')] + public function doNotSeeNotAllowedContentElementsInNewContentElementWizardTriggeredByContextMenu(BackendTester $I, PageTree $pageTree): void { $I->clickLayoutModuleButton(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithContainer-3']); - } else { - $pageTreeV13->openPath(['home', 'pageWithContainer-3']); - } + $pageTree->openPath(['home', 'pageWithContainer-3']); $I->wait(0.5); $I->switchToContentFrame(); - $typo3Version = GeneralUtility::makeInstance(Typo3Version::class); - if ($typo3Version->getMajorVersion() < 12) { - $I->waitForElement('#element-tt_content-810 a.t3js-contextmenutrigger'); - $I->click('#element-tt_content-810 a.t3js-contextmenutrigger'); - } else { - $I->waitForElement('#element-tt_content-800 [data-contextmenu-uid="810"]'); - $I->click('#element-tt_content-800 [data-contextmenu-uid="810"]'); - } - switch ($typo3Version->getMajorVersion()) { - case 11: - $I->waitForText('More options...'); - $I->click('.list-group-item-submenu'); - $I->waitForText('\'Create New\' wizard'); - $I->click('#contentMenu1 [data-callback-action="newContentWizard"]'); - break; - case 12: - $I->waitForText('More options...'); - $I->click('.context-menu-item-submenu'); - $I->waitForText('\'Create New\' wizard'); - $I->click('#contentMenu1'); - break; - default: - // v13 - $I->switchToMainFrame(); - $I->waitForElementVisible('typo3-backend-context-menu button[data-contextmenu-id="root_more"]', 5); - $I->click('button[data-contextmenu-id="root_more"]', 'typo3-backend-context-menu'); - $I->waitForElementVisible('typo3-backend-context-menu button[data-contextmenu-id="root_more_newWizard"]', 5); - $I->click('button[data-contextmenu-id="root_more_newWizard"]', 'typo3-backend-context-menu'); - break; - } + $I->waitForElement('#element-tt_content-800 [data-contextmenu-uid="810"]'); + $I->click('#element-tt_content-800 [data-contextmenu-uid="810"]'); + $I->switchToMainFrame(); + $I->waitForElementVisible('typo3-backend-context-menu button[data-contextmenu-id="root_more"]', 5); + $I->click('button[data-contextmenu-id="root_more"]', 'typo3-backend-context-menu'); + $I->waitForElementVisible('typo3-backend-context-menu button[data-contextmenu-id="root_more_newWizard"]', 5); + $I->click('button[data-contextmenu-id="root_more_newWizard"]', 'typo3-backend-context-menu'); $I->switchToIFrame(); $I->waitForModal(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); - } + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); $I->waitForText('Header Only'); $I->dontSee('Images Only'); } - /** - * @group content_defender - */ - public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenCreateNewElement(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + #[Group('content_defender')] + public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenCreateNewElement(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithContainer-4']); - } else { - $pageTreeV13->openPath(['home', 'pageWithContainer-4']); - } + $pageTree->openPath(['home', 'pageWithContainer-4']); $I->wait(0.5); $I->switchToContentFrame(); $dataColPos = $I->getDataColPos(801, 200); @@ -154,38 +92,20 @@ public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenCreateNewEl $I->clickNewContentElement($colPosSelector); $I->switchToIFrame(); $I->waitForModal(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); - } + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); $I->waitForText('Header Only'); - $typo3Version = GeneralUtility::makeInstance(Typo3Version::class); - if ($typo3Version->getMajorVersion() < 12) { - $I->click('Header Only'); - } else { - if ($typo3Version->getMajorVersion() < 13) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"common_header\"]').click()"); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); - } - } + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); $I->switchToContentFrame(); $I->wait(0.5); $I->see('textmedia', 'select'); $I->dontSee('Images Only', 'select'); } - /** - * @group content_defender - */ - public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenEditAnElement(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + #[Group('content_defender')] + public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenEditAnElement(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'contentTCASelectCtype']); - } else { - $pageTreeV13->openPath(['home', 'contentTCASelectCtype']); - } + $pageTree->openPath(['home', 'contentTCASelectCtype']); $I->wait(0.5); $I->switchToContentFrame(); $I->waitForElement('#element-tt_content-502 a[title="Edit"]'); @@ -195,18 +115,11 @@ public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenEditAnEleme $I->dontSee('Images Only', 'select'); } - /** - * @group content_defender - */ - public function canSeeNewContentButtonIfMaxitemsIsNotReached(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + #[Group('content_defender')] + public function canSeeNewContentButtonIfMaxitemsIsNotReached(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'contentDefenderMaxitems']); - } else { - $pageTreeV13->openPath(['home', 'contentDefenderMaxitems']); - } + $pageTree->openPath(['home', 'contentDefenderMaxitems']); $I->wait(0.5); $I->switchToContentFrame(); $dataColPos = $I->getDataColPos(402, 202); @@ -214,18 +127,11 @@ public function canSeeNewContentButtonIfMaxitemsIsNotReached(BackendTester $I, P $I->see('Content', '#element-tt_content-402 [data-colpos="' . $dataColPos . '"]'); } - /** - * @group content_defender - */ - public function canNotSeeNewContentButtonIfMaxitemsIsReached(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + #[Group('content_defender')] + public function canNotSeeNewContentButtonIfMaxitemsIsReached(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'contentDefenderMaxitems']); - } else { - $pageTreeV13->openPath(['home', 'contentDefenderMaxitems']); - } + $pageTree->openPath(['home', 'contentDefenderMaxitems']); $I->wait(0.5); $I->switchToContentFrame(); $dataColPos = $I->getDataColPos(401, 202); @@ -234,18 +140,11 @@ public function canNotSeeNewContentButtonIfMaxitemsIsReached(BackendTester $I, P $I->dontSee($newContentElementLabel, '#element-tt_content-401 [data-colpos="' . $dataColPos . '"]'); } - /** - * @group content_defender - */ - public function canCreateNewChildInContainerIfMaxitemsIsReachedInOtherContainer(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + #[Group('content_defender')] + public function canCreateNewChildInContainerIfMaxitemsIsReachedInOtherContainer(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'contentDefenderMaxitems']); - } else { - $pageTreeV13->openPath(['home', 'contentDefenderMaxitems']); - } + $pageTree->openPath(['home', 'contentDefenderMaxitems']); $I->wait(0.5); $I->switchToContentFrame(); $dataColPos = $I->getDataColPos(402, 202); @@ -253,37 +152,19 @@ public function canCreateNewChildInContainerIfMaxitemsIsReachedInOtherContainer( $I->clickNewContentElement($colPosSelector); $I->switchToIFrame(); $I->waitForModal(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); - } + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()"); $I->waitForText('Header Only'); - $typo3Version = GeneralUtility::makeInstance(Typo3Version::class); - if ($typo3Version->getMajorVersion() < 12) { - $I->click('Header Only'); - } else { - if ($typo3Version->getMajorVersion() < 13) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"common_header\"]').click()"); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); - } - } + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); $I->switchToContentFrame(); $I->waitForText('Create new Page Content on page'); $I->seeElement('#EditDocumentController'); } - /** - * @group content_defender - */ - public function seeEditDocumentWhenAddingChildrenToColposWhereOnlyHeaderIsAllowed(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + #[Group('content_defender')] + public function seeEditDocumentWhenAddingChildrenToColposWhereOnlyHeaderIsAllowed(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithDifferentContainers']); - } else { - $pageTreeV13->openPath(['home', 'pageWithDifferentContainers']); - } + $pageTree->openPath(['home', 'pageWithDifferentContainers']); $I->wait(0.5); $I->switchToContentFrame(); $dataColPos = $I->getDataColPos(300, 201); diff --git a/Tests/Acceptance/Backend/EditorLayoutCest.php b/Tests/Acceptance/Backend/EditorLayoutCest.php index 17556c31..99793f6a 100644 --- a/Tests/Acceptance/Backend/EditorLayoutCest.php +++ b/Tests/Acceptance/Backend/EditorLayoutCest.php @@ -14,27 +14,18 @@ use B13\Container\Tests\Acceptance\Support\BackendTester; use B13\Container\Tests\Acceptance\Support\PageTree; -use B13\Container\Tests\Acceptance\Support\PageTreeV13; class EditorLayoutCest { - /** - * @param BackendTester $I - */ public function _before(BackendTester $I) { $I->loginAs('editor'); } - public function canSeeNewContentButton(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + public function canSeeNewContentButton(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithContainer-5']); - } else { - $pageTreeV13->openPath(['home', 'pageWithContainer-5']); - } + $pageTree->openPath(['home', 'pageWithContainer-5']); $I->wait(0.2); $I->switchToContentFrame(); $dataColPos = $I->getDataColPos(802, 200); diff --git a/Tests/Acceptance/Backend/InfoModuleCest.php b/Tests/Acceptance/Backend/InfoModuleCest.php deleted file mode 100644 index 1046b868..00000000 --- a/Tests/Acceptance/Backend/InfoModuleCest.php +++ /dev/null @@ -1,50 +0,0 @@ -loginAs('admin'); - } - - public function canSeeContainerPageTsConfig(BackendTester $I, PageTree $pageTree, Scenario $scenario) - { - if ($I->getTypo3MajorVersion() >= 12) { - $scenario->skip('PageTsConfigModuleCest is used'); - } - $I->click('Info'); - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithContainer-6']); - $I->wait(0.2); - $I->switchToContentFrame(); - - $selectbox1Name = 'WebInfoJumpMenu'; - $selectbox2Name = 'SET[tsconf_parts]'; - - $I->waitForElement('select[name="' . $selectbox1Name . '"]'); - $I->selectOption('select[name="' . $selectbox1Name . '"]', 'Page TSconfig'); - $I->waitForElement('select[name="' . $selectbox2Name . '"]'); - $I->selectOption('select[name="' . $selectbox2Name . '"]', 99); - $I->see('show = b13-2cols-with-header-container'); - $I->dontSee('removeItems = b13-1col'); - } -} diff --git a/Tests/Acceptance/Backend/LayoutCest.php b/Tests/Acceptance/Backend/LayoutCest.php index 3a2407dd..5883f65c 100644 --- a/Tests/Acceptance/Backend/LayoutCest.php +++ b/Tests/Acceptance/Backend/LayoutCest.php @@ -14,32 +14,19 @@ use B13\Container\Tests\Acceptance\Support\BackendTester; use B13\Container\Tests\Acceptance\Support\PageTree; -use B13\Container\Tests\Acceptance\Support\PageTreeV13; use Codeception\Scenario; class LayoutCest { - /** - * @param BackendTester $I - */ public function _before(BackendTester $I) { $I->loginAs('admin'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - */ - public function connectedModeShowCorrectContentElements(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + public function connectedModeShowCorrectContentElements(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithLocalization']); - } else { - $pageTreeV13->openPath(['home', 'pageWithLocalization']); - } + $pageTree->openPath(['home', 'pageWithLocalization']); $I->wait(0.2); $I->switchToContentFrame(); $I->waitForText('2cols-header-0'); @@ -72,19 +59,10 @@ public function connectedModeShowCorrectContentElements(BackendTester $I, PageTr $I->dontSee('header-header-0', $languageCol . ' td.t3-grid-cell'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - */ - public function connectedModeShowNoAddContentButton(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + public function connectedModeShowNoAddContentButton(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithLocalization']); - } else { - $pageTreeV13->openPath(['home', 'pageWithLocalization']); - } + $pageTree->openPath(['home', 'pageWithLocalization']); $I->wait(0.2); $I->switchToContentFrame(); $I->selectGermanInLanguageMenu(); @@ -92,9 +70,7 @@ public function connectedModeShowNoAddContentButton(BackendTester $I, PageTree $ // we have a "Content" Button for new elements with Fluid based page module $newContentElementLabel = $I->getNewContentElementLabel(); $I->dontSee($newContentElementLabel, '#element-tt_content-102 .t3-page-ce-body'); - if ($I->getTypo3MajorVersion() < 12) { - $I->selectOption('select[name="actionMenu"]', 'Languages'); - } elseif ($I->getTypo3MajorVersion() < 14) { + if ($I->getTypo3MajorVersion() < 14) { $I->selectOption('select[name="actionMenu"]', 'Language Comparison'); } else { $I->waitForElementVisible('.module-docheader-buttons .btn-group button.dropdown-toggle'); @@ -107,44 +83,25 @@ public function connectedModeShowNoAddContentButton(BackendTester $I, PageTree $ $I->dontSee($newContentElementLabel, '#element-tt_content-102'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @throws \Exception - */ - public function canCreateContainerContentElement(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + public function canCreateContainerContentElement(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'emptyPage']); - } else { - $pageTreeV13->openPath(['home', 'emptyPage']); - } + $pageTree->openPath(['home', 'emptyPage']); $newContentElementLabel = $I->getNewContentElementLabel(); $I->wait(0.2); $I->switchToContentFrame(); $I->waitForText($newContentElementLabel); - if ($I->getTypo3MajorVersion() < 12) { - $I->click($newContentElementLabel); - } else { - $I->executeJS("document.querySelector('typo3-backend-new-content-element-wizard-button').click()"); - } + $I->executeJS("document.querySelector('typo3-backend-new-content-element-wizard-button').click()"); $I->switchToIFrame(); $I->waitForModal(); - if ($I->getTypo3MajorVersion() < 12) { - $I->click('Container'); - $I->click('2 Column Container With Header'); + $I->wait(0.5); + if ($I->getTypo3MajorVersion() > 13) { + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"container\"]').click()"); } else { - $I->wait(0.5); - if ($I->getTypo3MajorVersion() > 13) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"container\"]').click()"); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('container')"); - } - $I->wait(0.5); - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"container_b13-2cols-with-header-container\"]').click()"); + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('container')"); } + $I->wait(0.5); + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"container_b13-2cols-with-header-container\"]').click()"); $I->switchToContentFrame(); $I->click('Save'); $I->waitForElementNotVisible('#t3js-ui-block'); @@ -156,100 +113,47 @@ public function canCreateContainerContentElement(BackendTester $I, PageTree $pag $I->canSee('right side', '.t3-grid-container'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @throws \Exception - */ - public function canCreateContainerContentElementSaveAndClose(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + public function canCreateContainerContentElementSaveAndClose(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'emptyPage']); - } else { - $pageTreeV13->openPath(['home', 'emptyPage']); - } + $pageTree->openPath(['home', 'emptyPage']); $I->wait(0.2); $I->switchToContentFrame(); $newContentElementLabel = $I->getNewContentElementLabel(); $I->waitForText($newContentElementLabel); - if ($I->getTypo3MajorVersion() < 12) { - $I->click($newContentElementLabel); - } else { - $I->executeJS("document.querySelector('typo3-backend-new-content-element-wizard-button').click()"); - } + + $I->executeJS("document.querySelector('typo3-backend-new-content-element-wizard-button').click()"); $I->switchToIFrame(); $I->waitForModal(); - if ($I->getTypo3MajorVersion() < 12) { - $I->click('Container'); - // b13-2cols - // this also tests container-example eventListener - // https://github.com/b13/container-example/commit/df2560e75966a73754b5d4ea091d14727c16f024 - $I->click('2 Column mod -- Some Description of the Container'); + + if ($I->getTypo3MajorVersion() > 13) { + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"container\"]').click()"); } else { - if ($I->getTypo3MajorVersion() > 13) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"container\"]').click()"); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('container')"); - } - $I->wait(0.5); - // test event listener - $I->waitForText('mod -- Some Description of the Container'); - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"container_b13-2cols\"]').click()"); + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('container')"); } + $I->wait(0.5); + // test event listener + // b13-2cols + // this also tests container-example eventListener + // https://github.com/b13/container-example/commit/df2560e75966a73754b5d4ea091d14727c16f024 + $I->waitForText('mod -- Some Description of the Container'); + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"container_b13-2cols\"]').click()"); + $I->switchToContentFrame(); $I->waitForText('2-cols-left'); $I->canSee('2-cols-left', '.t3-grid-container'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @throws \Exception - */ - public function canDragAndDropElementOutsideIntoContainer(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13, Scenario $scenario) + public function canDragAndDropElementOutsideIntoContainer(BackendTester $I, PageTree $pageTree, Scenario $scenario) { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithContainerAndElementOutsice']); - } else { - $scenario->skip('drag and drop currently not work, s git show 4f459c2925be702ce93f047d7af32d296de1ddd6 Tests/Acceptance/Support/Helper/Mouse.php'); - $pageTreeV13->openPath(['home', 'pageWithContainerAndElementOutsice']); - } - $I->wait(0.2); - $I->switchToContentFrame(); - // header - $I->waitForElement('#element-tt_content-901'); - $dataColPos = $I->getDataColPos(900, 200); - $I->waitForElement('#element-tt_content-900 [data-colpos="' . $dataColPos . '"] .t3js-page-ce-dropzone-available'); - $I->dontSeeElement('#element-tt_content-900 #element-tt_content-901'); - $I->dragAndDrop('#element-tt_content-901 .t3js-page-ce-draghandle', '#element-tt_content-900 [data-colpos="' . $dataColPos . '"] .t3js-page-ce-dropzone-available'); - if ($I->getTypo3MajorVersion() < 13) { - $pageTree->openPath(['home', 'pageWithContainerAndElementOutsice']); - } else { - $pageTreeV13->openPath(['home', 'pageWithContainerAndElementOutsice']); - } - $I->wait(0.2); - $I->switchToContentFrame(); - $I->waitForElement('#element-tt_content-901'); - $I->seeElement('#element-tt_content-900 #element-tt_content-901'); + $scenario->skip('drag and drop currently not work, s git show 4f459c2925be702ce93f047d7af32d296de1ddd6 Tests/Acceptance/Support/Helper/Mouse.php'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - */ - public function newElementInHeaderColumnHasExpectedColPosAndParentSelected(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void + public function newElementInHeaderColumnHasExpectedColPosAndParentSelected(BackendTester $I, PageTree $pageTree): void { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithContainer-2']); - } else { - $pageTreeV13->openPath(['home', 'pageWithContainer-2']); - } + $pageTree->openPath(['home', 'pageWithContainer-2']); $I->wait(0.2); $I->switchToContentFrame(); // header @@ -259,38 +163,21 @@ public function newElementInHeaderColumnHasExpectedColPosAndParentSelected(Backe // "[data-colpos="700-200"]" can be attribute of "td" or "div" tag, depends if Fluid based page module is enabled $I->switchToIFrame(); $I->waitForModal(); - if ($I->getTypo3MajorVersion() < 12) { - $I->waitForText('Header Only'); - $I->click('Header Only'); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('header ')"); - $I->waitForText('Header Only'); - if ($I->getTypo3MajorVersion() < 13) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"common_header\"]').click()"); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); - } - } + + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('header ')"); + $I->waitForText('Header Only'); + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); + $I->switchToContentFrame(); $I->see('header [200]'); $I->see('2 Column Container With Header [700]'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @throws \Exception - */ - public function canCreateContentElementInContainer(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + public function canCreateContentElementInContainer(BackendTester $I, PageTree $pageTree) { //@depends canCreateContainer $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithContainer']); - } else { - $pageTreeV13->openPath(['home', 'pageWithContainer']); - } + $pageTree->openPath(['home', 'pageWithContainer']); $I->wait(0.2); $I->switchToContentFrame(); $dataColPos = $I->getDataColPos(1, 200); @@ -301,18 +188,11 @@ public function canCreateContentElementInContainer(BackendTester $I, PageTree $p $I->clickNewContentElement($containerColumn); $I->switchToIFrame(); $I->waitForModal(); - if ($I->getTypo3MajorVersion() < 12) { - $I->waitForText('Header Only'); - $I->click('Header Only'); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('header ')"); - $I->waitForText('Header Only'); - if ($I->getTypo3MajorVersion() < 13) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"common_header\"]').click()"); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); - } - } + + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('header ')"); + $I->waitForText('Header Only'); + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); + $I->switchToContentFrame(); $I->click('Save'); $I->waitForElementNotVisible('#t3js-ui-block'); @@ -321,21 +201,11 @@ public function canCreateContentElementInContainer(BackendTester $I, PageTree $p $I->canSeeElement($contentInContainerColumn); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @throws \Exception - */ - public function canCreateContentElementInTranslatedContainerInFreeMode(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + public function canCreateContentElementInTranslatedContainerInFreeMode(BackendTester $I, PageTree $pageTree) { //@depends canCreateContainer $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithLocalizationFreeModeWithContainer']); - } else { - $pageTreeV13->openPath(['home', 'pageWithLocalizationFreeModeWithContainer']); - } + $pageTree->openPath(['home', 'pageWithLocalizationFreeModeWithContainer']); $I->wait(0.2); $I->switchToContentFrame(); $I->selectGermanInLanguageMenu(); @@ -350,18 +220,11 @@ public function canCreateContentElementInTranslatedContainerInFreeMode(BackendTe $I->clickNewContentElement($colPosSelector); $I->switchToIFrame(); $I->waitForModal(); - if ($I->getTypo3MajorVersion() < 12) { - $I->waitForText('Header Only'); - $I->click('Header Only'); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('header ')"); - $I->waitForText('Header Only'); - if ($I->getTypo3MajorVersion() < 13) { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"common_header\"]').click()"); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); - } - } + + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('header ')"); + $I->waitForText('Header Only'); + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()"); + $I->switchToContentFrame(); $I->click('Save'); $I->waitForElementNotVisible('#t3js-ui-block'); @@ -370,21 +233,11 @@ public function canCreateContentElementInTranslatedContainerInFreeMode(BackendTe $I->canSeeElement($selector . ' .t3js-flag[title="german"]'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @throws \Exception - */ - public function canTranslateChildWithTranslationModule(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13, Scenario $scenario): void + public function canTranslateChildWithTranslationModule(BackendTester $I, PageTree $pageTree, Scenario $scenario): void { // test must be before canTranslateChild $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithTranslatedContainer']); - } else { - $pageTreeV13->openPath(['home', 'pageWithTranslatedContainer']); - } + $pageTree->openPath(['home', 'pageWithTranslatedContainer']); $I->wait(0.2); $I->switchToContentFrame(); @@ -399,10 +252,6 @@ public function canTranslateChildWithTranslationModule(BackendTester $I, PageTre } $I->switchToIFrame(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('.t3js-localization-option'); - $I->waitForElement('div[data-bs-slide="localize-summary"]'); - } if ($I->getTypo3MajorVersion() < 14) { $I->waitForText('(212) headerOfChild'); } else { @@ -410,20 +259,10 @@ public function canTranslateChildWithTranslationModule(BackendTester $I, PageTre } } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @throws \Exception - */ - public function canTranslateChild(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void + public function canTranslateChild(BackendTester $I, PageTree $pageTree): void { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithTranslatedContainer-2']); - } else { - $pageTreeV13->openPath(['home', 'pageWithTranslatedContainer-2']); - } + $pageTree->openPath(['home', 'pageWithTranslatedContainer-2']); $I->wait(0.2); $I->switchToContentFrame(); $I->waitForElement('#element-tt_content-712'); @@ -448,19 +287,10 @@ public function canTranslateChild(BackendTester $I, PageTree $pageTree, PageTree $I->see('[Translate to german:] headerOfChild'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - */ - public function canSeeContainerColumnTitleForDifferentContainers(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void + public function canSeeContainerColumnTitleForDifferentContainers(BackendTester $I, PageTree $pageTree): void { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithDifferentContainers']); - } else { - $pageTreeV13->openPath(['home', 'pageWithDifferentContainers']); - } + $pageTree->openPath(['home', 'pageWithDifferentContainers']); $I->wait(0.2); $I->switchToContentFrame(); // b13-2cols-with-header-container container @@ -473,70 +303,38 @@ public function canSeeContainerColumnTitleForDifferentContainers(BackendTester $ $I->see('2-cols-right'); } - public function canSeeCustomBackendTemplate(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13, Scenario $scenario): void + public function canSeeCustomBackendTemplate(BackendTester $I, PageTree $pageTree, Scenario $scenario): void { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithDifferentContainers']); - } else { - $pageTreeV13->openPath(['home', 'pageWithDifferentContainers']); - } + $pageTree->openPath(['home', 'pageWithDifferentContainers']); $I->wait(0.2); $I->switchToContentFrame(); $I->waitForElement('#tx-container-example-custom-backend-template'); $I->see('custom backend template'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @throws \Exception - */ - public function canSeeDescriptionOfContainerInNewContentElementWizard(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + public function canSeeDescriptionOfContainerInNewContentElementWizard(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'emptyPage']); - } else { - $pageTreeV13->openPath(['home', 'emptyPage']); - } + $pageTree->openPath(['home', 'emptyPage']); $I->wait(0.2); $I->switchToContentFrame(); $newContentElementLabel = $I->getNewContentElementLabel(); $I->waitForText($newContentElementLabel); - if ($I->getTypo3MajorVersion() < 12) { - $I->click($newContentElementLabel); - } else { - $I->executeJS("document.querySelector('typo3-backend-new-content-element-wizard-button').click()"); - } + $I->executeJS("document.querySelector('typo3-backend-new-content-element-wizard-button').click()"); $I->switchToIFrame(); $I->waitForModal(); - if ($I->getTypo3MajorVersion() < 12) { - $I->click('Container'); - } else { - $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('container')"); - $I->wait(0.5); - } + $I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').filter('container')"); + $I->wait(0.5); + $I->see('Some Description of the Container'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @throws \Exception - */ - public function canDisableContainerContentElementInNewContentElementWizard(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + public function canDisableContainerContentElementInNewContentElementWizard(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'emptyPage']); - } else { - $pageTreeV13->openPath(['home', 'emptyPage']); - } + $pageTree->openPath(['home', 'emptyPage']); $newContentElementLabel = $I->getNewContentElementLabel(); $I->wait(0.2); $I->switchToContentFrame(); diff --git a/Tests/Acceptance/Backend/PageTsConfigModuleCest.php b/Tests/Acceptance/Backend/PageTsConfigModuleCest.php index 1b8bafaa..b54f3d13 100644 --- a/Tests/Acceptance/Backend/PageTsConfigModuleCest.php +++ b/Tests/Acceptance/Backend/PageTsConfigModuleCest.php @@ -14,31 +14,18 @@ use B13\Container\Tests\Acceptance\Support\BackendTester; use B13\Container\Tests\Acceptance\Support\PageTree; -use B13\Container\Tests\Acceptance\Support\PageTreeV13; -use Codeception\Scenario; class PageTsConfigModuleCest { - /** - * @param BackendTester $I - */ public function _before(BackendTester $I) { $I->loginAs('admin'); } - public function canSeeContainerPageTsConfig(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13, Scenario $scenario) + public function canSeeContainerPageTsConfig(BackendTester $I, PageTree $pageTree) { - if ($I->getTypo3MajorVersion() < 12) { - $scenario->skip('InfoModuleCest is used'); - } $I->click('Page TSconfig'); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithContainer-6']); - } else { - $pageTreeV13->openPath(['home', 'pageWithContainer-6']); - } + $pageTree->openPath(['home', 'pageWithContainer-6']); $I->wait(0.2); $I->switchToContentFrame(); @@ -52,21 +39,11 @@ public function canSeeContainerPageTsConfig(BackendTester $I, PageTree $pageTree $I->waitForElementVisible('.module-docheader-buttons .dropdown-menu'); $I->click('Active page TSconfig', '.module-docheader-buttons .dropdown-menu'); } - if ($I->getTypo3MajorVersion() < 13) { - $I->fillField('searchValue', 'b13-2cols-with-header-container'); - } else { - $I->fillField('searchValue', 'b13-1col'); - } + $I->fillField('searchValue', 'b13-1col'); $I->waitForText('Configuration'); $I->click('Configuration'); - if ($I->getTypo3MajorVersion() > 12) { - $I->waitForText('b13-1col'); - $I->dontSee('show = b13-2cols-with-header-container'); - $I->see('removeItems = b13-1col'); - } else { - $I->waitForText('b13-2cols-with-header-container'); - $I->see('show = b13-2cols-with-header-container'); - $I->dontSee('removeItems = b13-1col'); - } + $I->waitForText('b13-1col'); + $I->dontSee('show = b13-2cols-with-header-container'); + $I->see('removeItems = b13-1col'); } } diff --git a/Tests/Acceptance/Backend/WorkspaceCest.php b/Tests/Acceptance/Backend/WorkspaceCest.php index 13c7776f..6a7497e4 100644 --- a/Tests/Acceptance/Backend/WorkspaceCest.php +++ b/Tests/Acceptance/Backend/WorkspaceCest.php @@ -14,40 +14,27 @@ use B13\Container\Tests\Acceptance\Support\BackendTester; use B13\Container\Tests\Acceptance\Support\PageTree; -use B13\Container\Tests\Acceptance\Support\PageTreeV13; +use Codeception\Attribute\Group; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\TestingFramework\Core\Acceptance\Helper\Topbar; class WorkspaceCest { /** * Selector for the module container in the topbar - * - * @var string */ - public static $topBarModuleSelector = '#typo3-cms-workspaces-backend-toolbaritems-workspaceselectortoolbaritem'; + public static string $topBarModuleSelector = '#typo3-cms-workspaces-backend-toolbaritems-workspaceselectortoolbaritem'; - /** - * @param BackendTester $I - */ public function _before(BackendTester $I) { $I->loginAs('admin'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @group workspace - */ - public function liveWorkspaceShowsLiveElements(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + #[Group('workspace')] + public function liveWorkspaceShowsLiveElements(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithWorkspace']); - } else { - $pageTreeV13->openPath(['home', 'pageWithWorkspace']); - } + $pageTree->openPath(['home', 'pageWithWorkspace']); $I->wait(0.2); $I->switchToContentFrame(); $I->waitForText('header-live'); @@ -56,21 +43,12 @@ public function liveWorkspaceShowsLiveElements(BackendTester $I, PageTree $pageT $I->dontSee('header-new-ws'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @group workspace - */ - public function testWorkspaceShowsWorkspaceElements(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + #[Group('workspace')] + public function testWorkspaceShowsWorkspaceElements(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); $this->switchToTestWs($I); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithWorkspace']); - } else { - $pageTreeV13->openPath(['home', 'pageWithWorkspace']); - } + $pageTree->openPath(['home', 'pageWithWorkspace']); $I->wait(0.2); $I->switchToContentFrame(); $I->waitForText('header-ws'); @@ -80,20 +58,11 @@ public function testWorkspaceShowsWorkspaceElements(BackendTester $I, PageTree $ $this->switchToLiveWs($I); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @group workspace - */ - public function liveWorkspaceShowsLiveElementsForTranslations(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void + #[Group('workspace')] + public function liveWorkspaceShowsLiveElementsForTranslations(BackendTester $I, PageTree $pageTree): void { $I->clickLayoutModuleButton(); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithWorkspace']); - } else { - $pageTreeV13->openPath(['home', 'pageWithWorkspace']); - } + $pageTree->openPath(['home', 'pageWithWorkspace']); $I->wait(0.2); $I->switchToContentFrame(); $I->selectGermanInLanguageMenu(); @@ -103,21 +72,12 @@ public function liveWorkspaceShowsLiveElementsForTranslations(BackendTester $I, $I->dontSee('translation-ws'); } - /** - * @param BackendTester $I - * @param PageTree $pageTree - * @group workspace - */ - public function testWorkspaceShowsLiveElementsForTranslations(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void + #[Group('workspace')] + public function testWorkspaceShowsLiveElementsForTranslations(BackendTester $I, PageTree $pageTree): void { $I->clickLayoutModuleButton(); $this->switchToTestWs($I); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithWorkspace']); - } else { - $pageTreeV13->openPath(['home', 'pageWithWorkspace']); - } + $pageTree->openPath(['home', 'pageWithWorkspace']); $I->wait(0.2); $I->switchToContentFrame(); $I->selectGermanInLanguageMenu(); @@ -127,19 +87,12 @@ public function testWorkspaceShowsLiveElementsForTranslations(BackendTester $I, $this->switchToLiveWs($I); } - /** - * @group workspace - */ - public function testWorkspaceShowsLiveContainerUidForContainerParentFieldWhenContainerIsAlreadyMoved(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13) + #[Group('workspace')] + public function testWorkspaceShowsLiveContainerUidForContainerParentFieldWhenContainerIsAlreadyMoved(BackendTester $I, PageTree $pageTree) { $I->clickLayoutModuleButton(); $this->switchToTestWs($I); - if ($I->getTypo3MajorVersion() < 13) { - $I->waitForElement('#typo3-pagetree-tree .nodes .node'); - $pageTree->openPath(['home', 'pageWithWorkspace-movedContainer']); - } else { - $pageTreeV13->openPath(['home', 'pageWithWorkspace-movedContainer']); - } + $pageTree->openPath(['home', 'pageWithWorkspace-movedContainer']); $I->wait(0.2); $I->switchToContentFrame(); // 600 is live uid (603 is ws uid) @@ -148,33 +101,33 @@ public function testWorkspaceShowsLiveContainerUidForContainerParentFieldWhenCon $this->switchToLiveWs($I); } - /** - * @param BackendTester $I - */ protected function switchToLiveWs(BackendTester $I): void { $this->switchToWs($I, 'LIVE workspace'); $I->wait(0.3); } - /** - * @param BackendTester $I - */ protected function switchToTestWs(BackendTester $I): void { $this->switchToWs($I, 'test-ws'); $I->wait(0.3); } - /** - * @param BackendTester $I - * @param string $ws - */ protected function switchToWs(BackendTester $I, string $ws): void { - $I->switchToMainFrame(); - $I->click(Topbar::$dropdownToggleSelector, self::$topBarModuleSelector); - $I->canSee($ws, self::$topBarModuleSelector); - $I->click($ws, self::$topBarModuleSelector); + if ($I->getTypo3MajorVersion() > 13 && (new Typo3Version())->getBranch() !== '14.1') { + $I->switchToMainFrame(); + if ($ws === 'test-ws') { + $I->executeJS("document.querySelector('typo3-backend-workspace-selector #workspace-menu button[title=\"test-ws\"]').click();"); + } else { + // first button + $I->executeJS("document.querySelector('typo3-backend-workspace-selector #workspace-menu button').click();"); + } + } else { + $I->switchToMainFrame(); + $I->click(Topbar::$dropdownToggleSelector, self::$topBarModuleSelector); + $I->canSee($ws, self::$topBarModuleSelector); + $I->click($ws, self::$topBarModuleSelector); + } } } diff --git a/Tests/Acceptance/Support/BackendTester.php b/Tests/Acceptance/Support/BackendTester.php index d1e86c81..f920513c 100644 --- a/Tests/Acceptance/Support/BackendTester.php +++ b/Tests/Acceptance/Support/BackendTester.php @@ -51,10 +51,7 @@ public function loginAs(string $username): void public function getDataColPos(int $containerId, int $colPos): string { - if ($this->getTypo3MajorVersion() > 11) { - return (string)$colPos; - } - return (string)($containerId . '-' . $colPos); + return (string)$colPos; } public function clickLayoutModuleButton(): void @@ -69,26 +66,16 @@ public function clickLayoutModuleButton(): void public function clickNewContentElement(string $colPosSelector): void { $this->waitForElement($colPosSelector); - if ($this->getTypo3MajorVersion() < 12) { - $this->click('Content', $colPosSelector); - return; - } $this->click($colPosSelector . ' typo3-backend-new-content-element-wizard-button'); } public function getNewContentElementLabel(): string { - if ($this->getTypo3MajorVersion() < 12) { - return 'Content'; - } return 'Create new content'; } public function getNewRecordWizardSelector(): string { - if ($this->getTypo3MajorVersion() < 13) { - return 'typo3-backend-new-content-element-wizard'; - } return 'typo3-backend-new-record-wizard'; } @@ -103,10 +90,7 @@ public function waitForModal(): void public function selectGermanInLanguageMenu(): void { - if ($this->getTypo3MajorVersion() < 12) { - $this->waitForElement('select[name="languageMenu"]'); - $this->selectOption('select[name="languageMenu"]', 'german'); - } elseif ($this->getTypo3MajorVersion() < 14) { + if ($this->getTypo3MajorVersion() < 14) { $this->waitForText('Language'); $this->click('Language'); $this->waitForText('german'); @@ -122,10 +106,7 @@ public function selectGermanInLanguageMenu(): void public function selectLanguageComparisonMode(): void { - if ($this->getTypo3MajorVersion() < 12) { - $this->waitForElement('select[name="actionMenu"]'); - $this->selectOption('select[name="actionMenu"]', 'Languages'); - } elseif ($this->getTypo3MajorVersion() < 14) { + if ($this->getTypo3MajorVersion() < 14) { $this->waitForElement('select[name="actionMenu"]'); $this->selectOption('select[name="actionMenu"]', 'Language Comparison'); } else { diff --git a/Tests/Acceptance/Support/PageTree.php b/Tests/Acceptance/Support/PageTree.php index 5ce0803a..fdb65685 100644 --- a/Tests/Acceptance/Support/PageTree.php +++ b/Tests/Acceptance/Support/PageTree.php @@ -12,17 +12,113 @@ * of the License, or any later version. */ -use TYPO3\TestingFramework\Core\Acceptance\Helper\AbstractPageTree; +use Facebook\WebDriver\Remote\RemoteWebElement; -class PageTree extends AbstractPageTree +// code copied from EXT:core tests + +class PageTree { + // Selectors + public static $treeSelector = '#typo3-pagetree-tree'; + public static $treeItemSelector = '.nodes-list > [role="treeitem"]'; + public static $treeItemAnchorSelector = '.node-contentlabel'; + + public function __construct(protected BackendTester $tester) + { + } + /** - * Inject our core AcceptanceTester actor into ModalDialog + * Waits until tree nodes are rendered + */ + public function waitForNodes(): void + { + $this->tester->waitForElement(static::$treeSelector . ' ' . static::$treeItemSelector, 5); + } + + /** + * Open the given hierarchical path in the pagetree and click the last page. * - * @param BackendTester $I + * Example to open "styleguide -> elements basic" page: + * [ + * 'styleguide TCA demo', + * 'elements basic', + * ] + * + * @param string[] $path */ - public function __construct(BackendTester $I) + public function openPath(array $path) { - $this->tester = $I; + $context = $this->getPageTreeElement(); + + $this->waitForNodes(); + + // Collapse all opened paths (might be opened due to localstorage) + do { + $toggled = false; + try { + // collapse last opened node element, that is not the root (=first node) + $context->findElement(\Facebook\WebDriver\WebDriverBy::xpath('(.//*[position()>1 and @role="treeitem" and */typo3-backend-icon/@identifier="actions-chevron-down"])[last()]/*[@class="node-toggle"]'))->click(); + $toggled = true; + } catch (\Facebook\WebDriver\Exception\NoSuchElementException $e) { + // element not found so it may be already opened... + } catch (\Facebook\WebDriver\Exception\ElementNotVisibleException $e) { + // element not found so it may be already opened... + } catch (\Facebook\WebDriver\Exception\ElementNotInteractableException $e) { + // another possible exception if the chevron isn't there ... depends on facebook driver version + } + } while ($toggled); + + foreach ($path as $pageName) { + $context = $this->ensureTreeNodeIsOpen($pageName, $context); + } + $context->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector(static::$treeItemAnchorSelector))->click(); + } + + /** + * Check if the pagetree is visible end return the web element object + * + * @return RemoteWebElement + */ + public function getPageTreeElement() + { + $I = $this->tester; + $I->switchToIFrame(); + return $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { + return $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector(static::$treeSelector)); + }); + } + + /** + * Search for an element with the given link text in the provided context. + * + * @param string $nodeText + * @param RemoteWebElement $context + * @return RemoteWebElement + */ + protected function ensureTreeNodeIsOpen(string $nodeText, RemoteWebElement $context) + { + $I = $this->tester; + $I->wait(0.1); + $I->see($nodeText, static::$treeItemSelector); + + /** @var RemoteWebElement $context */ + $context = $I->executeInSelenium(function () use ( + $nodeText, + $context + ) { + return $context->findElement(\Facebook\WebDriver\WebDriverBy::xpath('//*[@class=\'node-name\'][text()=\'' . $nodeText . '\']/../../..')); + }); + + try { + $context->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('.node-toggle > typo3-backend-icon[identifier=\'actions-chevron-end\']'))->click(); + } catch (\Facebook\WebDriver\Exception\NoSuchElementException $e) { + // element not found so it may be already opened... + } catch (\Facebook\WebDriver\Exception\ElementNotVisibleException $e) { + // element not found so it may be already opened... + } catch (\Facebook\WebDriver\Exception\ElementNotInteractableException $e) { + // another possible exception if the chevron isn't there ... depends on facebook driver version + } + + return $context; } } diff --git a/Tests/Acceptance/Support/PageTreeV13.php b/Tests/Acceptance/Support/PageTreeV13.php deleted file mode 100644 index 428c55e5..00000000 --- a/Tests/Acceptance/Support/PageTreeV13.php +++ /dev/null @@ -1,135 +0,0 @@ - [role="treeitem"]'; - public static $treeItemAnchorSelector = '.node-contentlabel'; - - /** - * @var BackendTester - */ - protected $tester; - - /** - * Inject our core AcceptanceTester actor into ModalDialog - * - * @param BackendTester $I - */ - public function __construct(BackendTester $I) - { - $this->tester = $I; - } - - /** - * Waits until tree nodes are rendered - */ - public function waitForNodes(): void - { - $this->tester->waitForElement(static::$treeSelector . ' ' . static::$treeItemSelector, 5); - } - - /** - * Open the given hierarchical path in the pagetree and click the last page. - * - * Example to open "styleguide -> elements basic" page: - * [ - * 'styleguide TCA demo', - * 'elements basic', - * ] - * - * @param string[] $path - */ - public function openPath(array $path) - { - $context = $this->getPageTreeElement(); - - $this->waitForNodes(); - - // Collapse all opened paths (might be opened due to localstorage) - do { - $toggled = false; - try { - // collapse last opened node element, that is not the root (=first node) - $context->findElement(\Facebook\WebDriver\WebDriverBy::xpath('(.//*[position()>1 and @role="treeitem" and */typo3-backend-icon/@identifier="actions-chevron-down"])[last()]/*[@class="node-toggle"]'))->click(); - $toggled = true; - } catch (\Facebook\WebDriver\Exception\NoSuchElementException $e) { - // element not found so it may be already opened... - } catch (\Facebook\WebDriver\Exception\ElementNotVisibleException $e) { - // element not found so it may be already opened... - } catch (\Facebook\WebDriver\Exception\ElementNotInteractableException $e) { - // another possible exception if the chevron isn't there ... depends on facebook driver version - } - } while ($toggled); - - foreach ($path as $pageName) { - $context = $this->ensureTreeNodeIsOpen($pageName, $context); - } - $context->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector(static::$treeItemAnchorSelector))->click(); - } - - /** - * Check if the pagetree is visible end return the web element object - * - * @return RemoteWebElement - */ - public function getPageTreeElement() - { - $I = $this->tester; - $I->switchToIFrame(); - return $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - return $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector(static::$treeSelector)); - }); - } - - /** - * Search for an element with the given link text in the provided context. - * - * @param string $nodeText - * @param RemoteWebElement $context - * @return RemoteWebElement - */ - protected function ensureTreeNodeIsOpen(string $nodeText, RemoteWebElement $context) - { - $I = $this->tester; - $I->wait(0.1); - $I->see($nodeText, static::$treeItemSelector); - - /** @var RemoteWebElement $context */ - $context = $I->executeInSelenium(function () use ( - $nodeText, - $context - ) { - return $context->findElement(\Facebook\WebDriver\WebDriverBy::xpath('//*[@class=\'node-name\'][text()=\'' . $nodeText . '\']/../../..')); - }); - - try { - $context->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('.node-toggle > typo3-backend-icon[identifier=\'actions-chevron-end\']'))->click(); - } catch (\Facebook\WebDriver\Exception\NoSuchElementException $e) { - // element not found so it may be already opened... - } catch (\Facebook\WebDriver\Exception\ElementNotVisibleException $e) { - // element not found so it may be already opened... - } catch (\Facebook\WebDriver\Exception\ElementNotInteractableException $e) { - // another possible exception if the chevron isn't there ... depends on facebook driver version - } - - return $context; - } -} diff --git a/Tests/Functional/Backend/Service/NewContentUriBuilderTest.php b/Tests/Functional/Backend/Service/NewContentUriBuilderTest.php index 8e25f9a3..753b951b 100644 --- a/Tests/Functional/Backend/Service/NewContentUriBuilderTest.php +++ b/Tests/Functional/Backend/Service/NewContentUriBuilderTest.php @@ -17,6 +17,7 @@ use B13\Container\Domain\Model\Container; use B13\Container\Domain\Service\ContainerService; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Backend\View\PageLayoutContext; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -28,9 +29,7 @@ class NewContentUriBuilderTest extends FunctionalTestCase 'typo3conf/ext/container', ]; - /** - * @test - */ + #[Test] public function getNewContentUrlAfterChildContainsUidOfLiveWorkspaceAsContainerParent(): void { $container = new Container(['uid' => 2, 't3ver_oid' => 1], []); @@ -54,9 +53,7 @@ public function getNewContentUrlAfterChildContainsUidOfLiveWorkspaceAsContainerP self::assertStringContainsString('tx_container_parent=1', $newContentUrl, 'should container uid of live workspace record'); } - /** - * @test - */ + #[Test] public function getNewContentUrlAtTopOfColumnContainsUidOfLiveWorkspaceAsContainerParent(): void { $container = new Container(['uid' => 2, 't3ver_oid' => 1], []); @@ -82,9 +79,7 @@ public function getNewContentUrlAtTopOfColumnContainsUidOfLiveWorkspaceAsContain self::assertStringContainsString('tx_container_parent=1', $newContentUrl, 'should container uid of live workspace record'); } - /** - * @test - */ + #[Test] public function getNewContentUrlAtTopOfColumnReturnsNullIfMaxitemsIsReached(): void { $container = new Container([], []); diff --git a/Tests/Functional/Datahandler/AbstractDatahandler.php b/Tests/Functional/Datahandler/AbstractDatahandler.php index dae40cfa..c5daa42e 100644 --- a/Tests/Functional/Datahandler/AbstractDatahandler.php +++ b/Tests/Functional/Datahandler/AbstractDatahandler.php @@ -18,48 +18,24 @@ abstract class AbstractDatahandler extends FunctionalTestCase { - /** - * @var DataHandler - */ - protected $dataHandler; + protected ?DataHandler $dataHandler = null; - /** - * @var BackendUserAuthentication - */ - protected $backendUser; + protected ?BackendUserAuthentication $backendUser = null; - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', ]; - /** - * @var non-empty-string[] - */ protected array $coreExtensionsToLoad = ['workspaces']; - protected function linkSiteConfigurationIntoTestInstance(): void - { - $from = ORIGINAL_ROOT . '../../Build/sites'; - $to = $this->getInstancePath() . '/typo3conf/sites'; - if (!is_dir($from)) { - throw new \Exception('site config directory not found', 1630425034); - } - if (!file_exists($to)) { - $success = symlink(realpath($from), $to); - if ($success === false) { - throw new \Exception('cannot link site config', 1630425035); - } - } - } + protected array $pathsToLinkInTestInstance = [ + 'typo3conf/ext/container/Build/sites' => 'typo3conf/sites', + ]; protected function setUp(): void { parent::setUp(); - $this->linkSiteConfigurationIntoTestInstance(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $this->backendUser = $GLOBALS['BE_USER'] = $this->setUpBackendUser(1); $GLOBALS['BE_USER'] = $this->backendUser; diff --git a/Tests/Functional/Datahandler/ContentDefender/AbstractContentDefender.php b/Tests/Functional/Datahandler/ContentDefender/AbstractContentDefender.php index b6315520..70bdb7c1 100644 --- a/Tests/Functional/Datahandler/ContentDefender/AbstractContentDefender.php +++ b/Tests/Functional/Datahandler/ContentDefender/AbstractContentDefender.php @@ -15,20 +15,13 @@ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\ServerRequest; -use TYPO3\CMS\Core\Information\Typo3Version; -use TYPO3\CMS\Core\Utility\GeneralUtility; abstract class AbstractContentDefender extends AbstractDatahandler { protected function setUp(): void { parent::setUp(); - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 12) { - // content_defender calls FormDataCompiler which wants access global variable TYPO3_REQUEST - $GLOBALS['TYPO3_REQUEST'] = null; - } elseif ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 12) { - // content_defender always returns true for restrictions if global variable TYPO3_REQUEST is null - $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE); - } + // content_defender always returns true for restrictions if global variable TYPO3_REQUEST is null + $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE); } } diff --git a/Tests/Functional/Datahandler/ContentDefender/CopyContainerTest.php b/Tests/Functional/Datahandler/ContentDefender/CopyContainerTest.php index a36f866b..b8477281 100644 --- a/Tests/Functional/Datahandler/ContentDefender/CopyContainerTest.php +++ b/Tests/Functional/Datahandler/ContentDefender/CopyContainerTest.php @@ -12,11 +12,11 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; + class CopyContainerTest extends AbstractContentDefender { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', @@ -29,10 +29,8 @@ protected function setUp(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/copy_container.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function copyContainerAfterElementCopiesChildEvenChildIsNotAllowedByContentDefenderInBackendLayout(): void { $cmdmap = [ @@ -54,10 +52,8 @@ public function copyContainerAfterElementCopiesChildEvenChildIsNotAllowedByConte self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyContainerAfterElementCopiesChildEvenChildIsNotAllowedByContentDefenderInBackendLayoutResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function copyContainerIntoOtherContainerWithSameColPosCopiesAlsoChildEvenChildIsDisallowedInTargetContainer(): void { $cmdmap = [ @@ -79,10 +75,8 @@ public function copyContainerIntoOtherContainerWithSameColPosCopiesAlsoChildEven self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyContainerIntoOtherContainerWithSameColPosCopiesAlsoChildEvenChildIsDisallowedInTargetContainerResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function copyContainerWithRestrictionsIgnoresContentDefender(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/copy_container_with_restrictions.csv'); diff --git a/Tests/Functional/Datahandler/ContentDefender/DefaultLanguageTest.php b/Tests/Functional/Datahandler/ContentDefender/DefaultLanguageTest.php index 116216ad..f8068bf7 100644 --- a/Tests/Functional/Datahandler/ContentDefender/DefaultLanguageTest.php +++ b/Tests/Functional/Datahandler/ContentDefender/DefaultLanguageTest.php @@ -12,11 +12,11 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; + class DefaultLanguageTest extends AbstractContentDefender { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', @@ -29,10 +29,8 @@ protected function setUp(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/setup.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function moveElementIntoContainerAtTopDoNotMoveDisallowedCTypeElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/disallowed_content_element.csv'); @@ -58,10 +56,8 @@ public function moveElementIntoContainerAtTopDoNotMoveDisallowedCTypeElement(): self::assertCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/MoveElementIntoContainerAtTopDoNotMoveDisallowedCTypeElementResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function moveElementIntoContainerAfterOtherElemenDoNotMoveDisallowedCTypeElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/disallowed_content_element.csv'); @@ -87,10 +83,8 @@ public function moveElementIntoContainerAfterOtherElemenDoNotMoveDisallowedCType self::assertCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/MoveElementIntoContainerAfterOtherElemenDoNotMoveDisallowedCTypeElementResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function copyElementIntoContainerAtTopDoNotCopyDisallowedCTypeElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/disallowed_content_element.csv'); @@ -116,10 +110,8 @@ public function copyElementIntoContainerAtTopDoNotCopyDisallowedCTypeElement(): self::assertCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/CopyElementIntoContainerAtTopDoNotCopyDisallowedCTypeElementResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function moveElementIntoContainerAtTopMoveAisallowedCTypeElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/allowed_content_element.csv'); @@ -145,10 +137,8 @@ public function moveElementIntoContainerAtTopMoveAisallowedCTypeElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/MoveElementIntoContainerAtTopMoveAisallowedCTypeElementResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function moveElementIntoContainerAfterOtherElemenMoveAllowedCTypeElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/allowed_content_element.csv'); @@ -174,10 +164,8 @@ public function moveElementIntoContainerAfterOtherElemenMoveAllowedCTypeElement( self::assertCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/MoveElementIntoContainerAfterOtherElemenMoveAllowedCTypeElementResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function copyContentElementIntoContainerWhenCTypeIsNotAllowedInBackendLayoutColumn(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/CopyContentElementIntoContainerWhenCTypeIsNotAllowedInBackendLayoutColumn.csv'); @@ -205,10 +193,8 @@ public function copyContentElementIntoContainerWhenCTypeIsNotAllowedInBackendLay self::assertCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/CopyContentElementIntoContainerWhenCTypeIsNotAllowedInBackendLayoutColumnResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function copyElementIntoContainerAtTopCopyAllowedCTypeElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/allowed_content_element.csv'); @@ -234,10 +220,8 @@ public function copyElementIntoContainerAtTopCopyAllowedCTypeElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/CopyElementIntoContainerAtTopCopyAllowedCTypeElementResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function copyChildFromOtherContainerIntoColposWhereTargetElementInOtherColposHasRestrictionIsAllowd(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/CopyChildFromOtherContainerIntoColposWhereTargetElementInOtherColposHasRestrictionIsAllowed.csv'); diff --git a/Tests/Functional/Datahandler/ContentDefender/LocalizationTest.php b/Tests/Functional/Datahandler/ContentDefender/LocalizationTest.php index 9c337fa3..de6132e8 100644 --- a/Tests/Functional/Datahandler/ContentDefender/LocalizationTest.php +++ b/Tests/Functional/Datahandler/ContentDefender/LocalizationTest.php @@ -12,11 +12,11 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; + class LocalizationTest extends AbstractContentDefender { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', @@ -29,10 +29,8 @@ protected function setUp(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/Localization/setup.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function moveElementIntoContainerAtTopToNotMoveTranslationIfDisallowedCType(): void { $cmdmap = [ @@ -57,10 +55,8 @@ public function moveElementIntoContainerAtTopToNotMoveTranslationIfDisallowedCTy self::assertCSVDataSet(__DIR__ . '/Fixtures/Localization/MoveElementIntoContainerAtTopToNotMoveTranslationIfDisallowedCTypeResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function copyElementIntoContainerAtTopDoNotCopyTranslationIfDisallowedCType(): void { $cmdmap = [ diff --git a/Tests/Functional/Datahandler/ContentDefender/MaxItemsTest.php b/Tests/Functional/Datahandler/ContentDefender/MaxItemsTest.php index 7702755c..7e1448b4 100644 --- a/Tests/Functional/Datahandler/ContentDefender/MaxItemsTest.php +++ b/Tests/Functional/Datahandler/ContentDefender/MaxItemsTest.php @@ -12,29 +12,21 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; + +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Utility\StringUtility; class MaxItemsTest extends AbstractContentDefender { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', 'typo3conf/ext/content_defender', ]; - protected function setUp(): void - { - parent::setUp(); - $this->linkSiteConfigurationIntoTestInstance(); - } - - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canMoveElementIntoContainerIfMaxitemsIsNotReached(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanMoveElementIntoContainerIfMaxitemsIsNotReached.csv'); @@ -60,10 +52,8 @@ public function canMoveElementIntoContainerIfMaxitemsIsNotReached(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanMoveElementIntoContainerIfMaxitemsIsNotReachedResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function cannotMoveElementIntoContainerIfMaxitemsIsReached(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CannotMoveElementIntoContainerIfMaxitemsIsReached.csv'); @@ -90,10 +80,8 @@ public function cannotMoveElementIntoContainerIfMaxitemsIsReached(): void self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function cannotCopyElementIntoContainerIfMaxitemsIsReachedAfterIntoContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CannotCopyElementIntoContainerIfMaxitemsIsReachedAfterIntoContainer.csv'); @@ -122,10 +110,8 @@ public function cannotCopyElementIntoContainerIfMaxitemsIsReachedAfterIntoContai self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function cannotCopyElementIntoContainerIfMaxitemsIsReachedAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CannotCopyElementIntoContainerIfMaxitemsIsReachedAfterElement.csv'); @@ -143,10 +129,8 @@ public function cannotCopyElementIntoContainerIfMaxitemsIsReachedAfterElement(): self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canCreateElementInContainerIfMaxitemsIsNotReached(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanCreateElementInContainerIfMaxitemsIsNotReached.csv'); @@ -169,10 +153,8 @@ public function canCreateElementInContainerIfMaxitemsIsNotReached(): void self::assertSame([], $this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function cannotCreateElementInContainerIfMaxitemsIsReached(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CannotCreateElementInContainerIfMaxitemsIsReached.csv'); @@ -194,10 +176,8 @@ public function cannotCreateElementInContainerIfMaxitemsIsReached(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CannotCreateElementInContainerIfMaxitemsIsReachedResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canEditElementInContainerWhenMaxitemIsReached(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanEditElementInContainerWhenMaxitemIsReached.csv'); @@ -219,10 +199,8 @@ public function canEditElementInContainerWhenMaxitemIsReached(): void self::assertSame([], $this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canMoveContainerWithMaxitemsReachedColumnToOtherPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanMoveContainerWithMaxitemsReachedColumnToOtherPage.csv'); @@ -248,10 +226,8 @@ public function canMoveContainerWithMaxitemsReachedColumnToOtherPage(): void self::assertSame([], $this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canCopyElementFromContainerMaxitemsReachedColumnToOtherColumn(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanCopyElementFromContainerMaxitemsReachedColumnToOtherColumn.csv'); @@ -276,10 +252,8 @@ public function canCopyElementFromContainerMaxitemsReachedColumnToOtherColumn(): self::assertSame([], $this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canCopyElementFromContainerMaxitemsReachedColumnToOtherContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanCopyElementFromContainerMaxitemsReachedColumnToOtherContainer.csv'); @@ -304,10 +278,8 @@ public function canCopyElementFromContainerMaxitemsReachedColumnToOtherContainer self::assertSame([], $this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canMoveElementFromContainerMaxitemsReachedColumnToOtherContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanMoveElementFromContainerMaxitemsReachedColumnToOtherContainer.csv'); @@ -332,10 +304,8 @@ public function canMoveElementFromContainerMaxitemsReachedColumnToOtherContainer self::assertSame([], $this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function cannotMoveElementInsideContainerColumnIfMaxitemsIsReached(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CannotMoveElementInsideContainerColumnIfMaxitemsIsReached.csv'); @@ -359,10 +329,8 @@ public function cannotMoveElementInsideContainerColumnIfMaxitemsIsReached(): voi self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canTranslateChildIfContainerOfDefaultLanguageMaxitemsIsReached(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanTranslateChildIfContainerOfDefaultLanguageMaxitemsIsReached.csv'); @@ -378,10 +346,8 @@ public function canTranslateChildIfContainerOfDefaultLanguageMaxitemsIsReached() self::assertEmpty($this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canCopyToLanguageChildIfContainerOfDefaultLanguageMaxitemsIsReached(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanCopyToLanguageChildIfContainerOfDefaultLanguageMaxitemsIsReached.csv'); @@ -397,10 +363,8 @@ public function canCopyToLanguageChildIfContainerOfDefaultLanguageMaxitemsIsReac self::assertEmpty($this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canSaveChildInDefaultLanguageWhenTranslatedAndMaxitemsIsReached(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanSaveChildInDefaultLanguageWhenTranslatedAndMaxitemsIsReached.csv'); @@ -424,10 +388,8 @@ public function canSaveChildInDefaultLanguageWhenTranslatedAndMaxitemsIsReached( self::assertEmpty($this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canCopyFilledContainerWithMaxitemsReachedColumnToTopOfPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/filled_container.csv'); @@ -452,10 +414,8 @@ public function canCopyFilledContainerWithMaxitemsReachedColumnToTopOfPage(): vo self::assertCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanCopyFilledContainerWithMaxitemsReachedColumnToTopOfPageResult.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canCopyChildFromFilledContainerFromMaxItemsReachedColumnToTopOfPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/filled_container.csv'); @@ -480,10 +440,8 @@ public function canCopyChildFromFilledContainerFromMaxItemsReachedColumnToTopOfP self::assertCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanCopyChildFromFilledContainerFromMaxItemsReachedColumnToTopOfPage.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function canCopyChildFromFilledContainerWhenCopyPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/filled_container.csv'); @@ -501,10 +459,8 @@ public function canCopyChildFromFilledContainerWhenCopyPage(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Maxitems/CanCopyChildFromFilledContainerWhenCopyPage.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function cannotCopyChildFromFilledContainerIntoMaxItemsReachedColumnAfterChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/filled_container.csv'); @@ -529,10 +485,8 @@ public function cannotCopyChildFromFilledContainerIntoMaxItemsReachedColumnAfter self::assertCSVDataSet(__DIR__ . '/Fixtures/Maxitems/filled_container.csv'); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function cannotCopyChildFromFilledContainerIntoMaxItemsReachedColumnAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Maxitems/filled_container.csv'); diff --git a/Tests/Functional/Datahandler/DefaultLanguage/ContainerTest.php b/Tests/Functional/Datahandler/DefaultLanguage/ContainerTest.php index 1d5e0b3f..ebf879bf 100644 --- a/Tests/Functional/Datahandler/DefaultLanguage/ContainerTest.php +++ b/Tests/Functional/Datahandler/DefaultLanguage/ContainerTest.php @@ -13,14 +13,13 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Utility\GeneralUtility; class ContainerTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function moveContainerIntoItSelfsNestedAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerIntoItSelfsNestedAfterElement.csv'); @@ -38,9 +37,7 @@ public function moveContainerIntoItSelfsNestedAfterElement(): void self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is empty'); } - /** - * @test - */ + #[Test] public function moveContainerIntoItSelfsNestedAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerIntoItSelfsNestedAtTop.csv'); @@ -66,9 +63,7 @@ public function moveContainerIntoItSelfsNestedAtTop(): void self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is empty'); } - /** - * @test - */ + #[Test] public function moveContainerIntoItSelfsAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerIntoItSelfsAtTop.csv'); @@ -94,9 +89,7 @@ public function moveContainerIntoItSelfsAtTop(): void self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is empty'); } - /** - * @test - */ + #[Test] public function deleteContainerDeleteChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/DeleteContainerDeleteChildren.csv'); @@ -112,9 +105,7 @@ public function deleteContainerDeleteChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/DeleteContainerDeleteChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerAfterElementMovesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerAfterElementMovesChildren.csv'); @@ -140,9 +131,7 @@ public function moveContainerAfterElementMovesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerAfterElementMovesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerToOtherPageAtTopMovesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToOtherPageAtTopMovesChildren.csv'); @@ -166,9 +155,7 @@ public function moveContainerToOtherPageAtTopMovesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToOtherPageAtTopMovesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerToOtherPageAtTopCopiesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToOtherPageAtTopCopiesChildren.csv'); @@ -190,9 +177,7 @@ public function copyContainerToOtherPageAtTopCopiesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToOtherPageAtTopCopiesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerToOtherPageAfterElementCopiesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToOtherPageAfterElementCopiesChildren.csv'); @@ -214,9 +199,7 @@ public function copyContainerToOtherPageAfterElementCopiesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToOtherPageAfterElementCopiesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerToOtherPageAfterElementMovesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToOtherPageAfterElementMovesChildren.csv'); @@ -240,9 +223,7 @@ public function moveContainerToOtherPageAfterElementMovesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToOtherPageAfterElementMovesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerKeepsSortingOfChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerKeepsSortingOfChildren.csv'); @@ -264,9 +245,7 @@ public function copyContainerKeepsSortingOfChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerKeepsSortingOfChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerOtherPageOnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerOtherPageOnTop.csv'); @@ -282,9 +261,7 @@ public function moveContainerOtherPageOnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerOtherPageOnTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerOtherPageAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerOtherPageAfterElement.csv'); @@ -300,9 +277,7 @@ public function moveContainerOtherPageAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerOtherPageAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerOtherPageOnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerOtherPageOnTop.csv'); @@ -322,9 +297,7 @@ public function copyContainerOtherPageOnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerOtherPageOnTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerOtherPageAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerOtherPageAfterElement.csv'); @@ -344,9 +317,7 @@ public function copyContainerOtherPageAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerOtherPageAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerWithDataHandlerLoggingDisabled(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerWithDataHandlerLoggingDisabled.csv'); @@ -368,9 +339,7 @@ public function copyContainerWithDataHandlerLoggingDisabled(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerWithDataHandlerLoggingDisabledSysLogResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerWithLanguageAsStringKeepsCopiedChildrenSorting(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerKeepsSortingOfChildren.csv'); diff --git a/Tests/Functional/Datahandler/DefaultLanguage/CopyContainerInContainerTest.php b/Tests/Functional/Datahandler/DefaultLanguage/CopyContainerInContainerTest.php index 8bd5c180..5be99872 100644 --- a/Tests/Functional/Datahandler/DefaultLanguage/CopyContainerInContainerTest.php +++ b/Tests/Functional/Datahandler/DefaultLanguage/CopyContainerInContainerTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class CopyContainerInContainerTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function copyContainerWithChildContainersCopiesContentInChildContainersIntoCorrectContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyContainerInContainer/CopyContainerWithChildContainersCopiesContentInChildContainersIntoCorrectContainer.csv'); diff --git a/Tests/Functional/Datahandler/DefaultLanguage/CopyElementOtherPageTest.php b/Tests/Functional/Datahandler/DefaultLanguage/CopyElementOtherPageTest.php index 3903f781..42a0217e 100644 --- a/Tests/Functional/Datahandler/DefaultLanguage/CopyElementOtherPageTest.php +++ b/Tests/Functional/Datahandler/DefaultLanguage/CopyElementOtherPageTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class CopyElementOtherPageTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function copyChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -43,9 +42,7 @@ public function copyChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -71,9 +68,7 @@ public function copyChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -99,9 +94,7 @@ public function copyChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -126,9 +119,7 @@ public function copyChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -154,9 +145,7 @@ public function copyElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -181,9 +170,7 @@ public function copyElementIntoContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyElementIntoContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAfterElementWithSimpleCommandMap(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -201,9 +188,7 @@ public function copyElementIntoContainerAfterElementWithSimpleCommandMap(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyElementIntoContainerAfterElementWithSimpleCommandMapResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementAfterContainerSortElementAfterLastContainerChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -228,9 +213,7 @@ public function copyElementAfterContainerSortElementAfterLastContainerChild(): v self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyElementAfterContainerSortElementAfterLastContainerChildResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementAfterContainerSortElementAfterLastContainerChildSimpleCommand(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); diff --git a/Tests/Functional/Datahandler/DefaultLanguage/CopyElementTest.php b/Tests/Functional/Datahandler/DefaultLanguage/CopyElementTest.php index 8f7c6df4..3c89ba9a 100644 --- a/Tests/Functional/Datahandler/DefaultLanguage/CopyElementTest.php +++ b/Tests/Functional/Datahandler/DefaultLanguage/CopyElementTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class CopyElementTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function copyChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -43,9 +42,7 @@ public function copyChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -71,9 +68,7 @@ public function copyChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -99,9 +94,7 @@ public function copyChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -126,9 +119,7 @@ public function copyChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -154,9 +145,7 @@ public function copyElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -181,9 +170,7 @@ public function copyElementIntoContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyElementIntoContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAfterElementWithSimpleCommandMap(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -201,9 +188,7 @@ public function copyElementIntoContainerAfterElementWithSimpleCommandMap(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyElementIntoContainerAfterElementWithSimpleCommandMapResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementAfterContainerWithSimpleCommandMap(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -221,9 +206,7 @@ public function copyElementAfterContainerWithSimpleCommandMap(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyElementAfterContainerWithSimpleCommandMapResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerIntoItSelfs(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -241,9 +224,7 @@ public function copyContainerIntoItSelfs(): void self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is not empty'); } - /** - * @test - */ + #[Test] public function copyMultipleContainersWithChildRecords(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); diff --git a/Tests/Functional/Datahandler/DefaultLanguage/CopyPageTest.php b/Tests/Functional/Datahandler/DefaultLanguage/CopyPageTest.php index 9a233f90..2da4d677 100644 --- a/Tests/Functional/Datahandler/DefaultLanguage/CopyPageTest.php +++ b/Tests/Functional/Datahandler/DefaultLanguage/CopyPageTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class CopyPageTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function copyPageCopiesChildrenOfContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyPage/CopyPageCopiesChildrenOfContainer.csv'); diff --git a/Tests/Functional/Datahandler/DefaultLanguage/MoveElementOtherPageTest.php b/Tests/Functional/Datahandler/DefaultLanguage/MoveElementOtherPageTest.php index 2dff2c5c..d197cd46 100644 --- a/Tests/Functional/Datahandler/DefaultLanguage/MoveElementOtherPageTest.php +++ b/Tests/Functional/Datahandler/DefaultLanguage/MoveElementOtherPageTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class MoveElementOtherPageTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -43,9 +42,7 @@ public function moveChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -71,9 +68,7 @@ public function moveChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -99,9 +94,7 @@ public function moveChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -126,9 +119,7 @@ public function moveChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -154,9 +145,7 @@ public function moveElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -181,9 +170,7 @@ public function moveElementIntoContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveElementIntoContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAfterElementWithSimpleCommandMap(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -201,9 +188,7 @@ public function moveElementIntoContainerAfterElementWithSimpleCommandMap(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveElementIntoContainerAfterElementWithSimpleCommandMapResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementAfterContainerSortElementAfterLastContainerChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -228,9 +213,7 @@ public function moveElementAfterContainerSortElementAfterLastContainerChild(): v self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveElementAfterContainerSortElementAfterLastContainerChildResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementAfterContainerSortElementAfterLastContainerChildSimpleCommand(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); diff --git a/Tests/Functional/Datahandler/DefaultLanguage/MoveElementTest.php b/Tests/Functional/Datahandler/DefaultLanguage/MoveElementTest.php index a2bd7ee1..f09be4b9 100644 --- a/Tests/Functional/Datahandler/DefaultLanguage/MoveElementTest.php +++ b/Tests/Functional/Datahandler/DefaultLanguage/MoveElementTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class MoveElementTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -43,9 +42,7 @@ public function moveChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -71,9 +68,7 @@ public function moveChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -99,9 +94,7 @@ public function moveChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -126,9 +119,7 @@ public function moveChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -154,9 +145,7 @@ public function moveElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -181,9 +170,7 @@ public function moveElementIntoContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveElementIntoContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAfterElementWithSimpleCommandMap(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -201,9 +188,7 @@ public function moveElementIntoContainerAfterElementWithSimpleCommandMap(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveElementIntoContainerAfterElementWithSimpleCommandMapResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerIntoItSelfs(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -221,9 +206,7 @@ public function moveContainerIntoItSelfs(): void self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is empty'); } - /** - * @test - */ + #[Test] public function moveElementAfterNestedContainerHasCorrectSorting(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/nested_container.csv'); @@ -240,9 +223,7 @@ public function moveElementAfterNestedContainerHasCorrectSorting(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveElementAfterNestedContainerHasCorrectSortingResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementWithSimpleCommandWithoutAnyContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/simple_command_without_any_container.csv'); diff --git a/Tests/Functional/Datahandler/DefaultLanguage/NewElementTest.php b/Tests/Functional/Datahandler/DefaultLanguage/NewElementTest.php index 4cab9bc5..40382219 100644 --- a/Tests/Functional/Datahandler/DefaultLanguage/NewElementTest.php +++ b/Tests/Functional/Datahandler/DefaultLanguage/NewElementTest.php @@ -13,13 +13,12 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Utility\StringUtility; class NewElementTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function newElementAfterContainerSortElementAfterLastChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/NewElement/NewElementAfterContainerSortElementAfterLastChild.csv'); @@ -37,9 +36,7 @@ public function newElementAfterContainerSortElementAfterLastChild(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/NewElement/NewElementAfterContainerSortElementAfterLastChildResult.csv'); } - /** - * @test - */ + #[Test] public function newElementAfterNestedContainerSortElementAfterLastChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/NewElement/NewElementAfterNestedContainerSortElementAfterLastChild.csv'); @@ -59,9 +56,7 @@ public function newElementAfterNestedContainerSortElementAfterLastChild(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/NewElement/NewElementAfterNestedContainerSortElementAfterLastChildResult.csv'); } - /** - * @test - */ + #[Test] public function newElementAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/NewElement/NewElementAtTop.csv'); @@ -83,9 +78,7 @@ public function newElementAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/NewElement/NewElementAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function newElementAfterChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/NewElement/NewElementAfterChild.csv'); @@ -107,9 +100,7 @@ public function newElementAfterChild(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/NewElement/NewElementAfterChildResult.csv'); } - /** - * @test - */ + #[Test] public function newElementInNexCol(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/NewElement/NewElementInNextCol.csv'); diff --git a/Tests/Functional/Datahandler/FixturesTest.php b/Tests/Functional/Datahandler/FixturesTest.php index 5891facc..617d46a5 100644 --- a/Tests/Functional/Datahandler/FixturesTest.php +++ b/Tests/Functional/Datahandler/FixturesTest.php @@ -15,6 +15,9 @@ use B13\Container\Integrity\Database; use B13\Container\Integrity\Sorting; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use Symfony\Component\Finder\Finder; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Localization\LanguageServiceFactory; @@ -23,19 +26,13 @@ class FixturesTest extends FunctionalTestCase { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', ]; - protected Sorting $sorting; + protected ?Sorting $sorting = null; - /** - * @var non-empty-string[] - */ protected array $coreExtensionsToLoad = ['workspaces']; protected function setUp(): void @@ -53,9 +50,6 @@ protected function setUp(): void $this->sorting = GeneralUtility::makeInstance(Sorting::class, $sortingDatabase, $containerRegistry, $containerFactory, $containerService); } - /** - * @return array - */ public static function csvProvider(): array { $finder = new Finder(); @@ -71,11 +65,9 @@ public static function csvProvider(): array return $results; } - /** - * @test - * @dataProvider csvProvider - * @group fixtures - */ + #[Test] + #[Group('fixtures')] + #[DataProvider('csvProvider')] public function fixturesSorting(string $csv): void { $this->importCSVDataSet(__DIR__ . '/' . $csv); diff --git a/Tests/Functional/Datahandler/Localization/ConnectedMode/ContainerTest.php b/Tests/Functional/Datahandler/Localization/ConnectedMode/ContainerTest.php index 8798a717..42e625c2 100644 --- a/Tests/Functional/Datahandler/Localization/ConnectedMode/ContainerTest.php +++ b/Tests/Functional/Datahandler/Localization/ConnectedMode/ContainerTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class ContainerTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function deleteContainerDeleteTranslatedChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/DeleteContainerDeleteTranslatedChildren.csv'); @@ -34,9 +33,7 @@ public function deleteContainerDeleteTranslatedChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/DeleteContainerDeleteTranslatedChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerToOtherPageMovesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToOtherPageMovesChildren.csv'); diff --git a/Tests/Functional/Datahandler/Localization/ConnectedMode/CopyElementTest.php b/Tests/Functional/Datahandler/Localization/ConnectedMode/CopyElementTest.php index 20e26903..293a9e45 100644 --- a/Tests/Functional/Datahandler/Localization/ConnectedMode/CopyElementTest.php +++ b/Tests/Functional/Datahandler/Localization/ConnectedMode/CopyElementTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class CopyElementTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function copyElementAfterContainerCopiesTranslationAfterContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/copy_element_after_container.csv'); @@ -38,9 +37,7 @@ public function copyElementAfterContainerCopiesTranslationAfterContainer(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyElementAfterContainerCopiesTranslationAfterContainerResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementAfterContainerWithChildKeepsColPosForTranslatedElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/copy_element_after_container_with_child.csv'); diff --git a/Tests/Functional/Datahandler/Localization/ConnectedMode/MoveElementOtherPageTest.php b/Tests/Functional/Datahandler/Localization/ConnectedMode/MoveElementOtherPageTest.php index 3cf63ad4..476ac91b 100644 --- a/Tests/Functional/Datahandler/Localization/ConnectedMode/MoveElementOtherPageTest.php +++ b/Tests/Functional/Datahandler/Localization/ConnectedMode/MoveElementOtherPageTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class MoveElementOtherPageTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -43,9 +42,7 @@ public function moveChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -71,9 +68,7 @@ public function moveChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -99,9 +94,7 @@ public function moveChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -126,9 +119,7 @@ public function moveChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -154,9 +145,7 @@ public function moveElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); diff --git a/Tests/Functional/Datahandler/Localization/ConnectedMode/MoveElementTest.php b/Tests/Functional/Datahandler/Localization/ConnectedMode/MoveElementTest.php index e0862981..d040f7fc 100644 --- a/Tests/Functional/Datahandler/Localization/ConnectedMode/MoveElementTest.php +++ b/Tests/Functional/Datahandler/Localization/ConnectedMode/MoveElementTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class MoveElementTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -43,9 +42,7 @@ public function moveChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -71,9 +68,7 @@ public function moveChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -99,9 +94,7 @@ public function moveChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -126,9 +119,7 @@ public function moveChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -154,9 +145,7 @@ public function moveElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); diff --git a/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php b/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php index 0665546a..f07ca0ca 100644 --- a/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php +++ b/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; class CopyToLanguageSortingTest extends AbstractDatahandler { - /** - * @return array - */ public static function localizeKeepsSortingDataProvider(): array { return [ @@ -37,10 +36,8 @@ public static function localizeKeepsSortingDataProvider(): array ]; } - /** - * @test - * @dataProvider localizeKeepsSortingDataProvider - */ + #[Test] + #[DataProvider('localizeKeepsSortingDataProvider')] public function localizeKeepsSorting(array $cmdmap, string $dataset): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeKeepsSorting.csv'); @@ -49,9 +46,7 @@ public function localizeKeepsSorting(array $cmdmap, string $dataset): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeKeepsSorting' . $dataset . 'Result.csv'); } - /** - * @test - */ + #[Test] public function localizeChildAtTopOfContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeChildAtTopOfContainer.csv'); @@ -67,9 +62,7 @@ public function localizeChildAtTopOfContainer(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeChildAtTopOfContainerResult.csv'); } - /** - * @test - */ + #[Test] public function localizeChildAfterContainerChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/localize_child_after_child.csv'); @@ -85,9 +78,7 @@ public function localizeChildAfterContainerChild(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeChildAfterContainerChildResult.csv'); } - /** - * @test - */ + #[Test] public function localizeWithNestedElements(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElements.csv'); @@ -103,9 +94,7 @@ public function localizeWithNestedElements(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElementsResult.csv'); } - /** - * @test - */ + #[Test] public function localizeWithMultipleNestedElements(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeWithMultipleNestedElements.csv'); diff --git a/Tests/Functional/Datahandler/Localization/Fixtures/Localize/LegacyLocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv b/Tests/Functional/Datahandler/Localization/Fixtures/Localize/LegacyLocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv new file mode 100644 index 00000000..125799b6 --- /dev/null +++ b/Tests/Functional/Datahandler/Localization/Fixtures/Localize/LegacyLocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv @@ -0,0 +1,10 @@ +"pages" +,"uid","pid","title" +,1,0,"" +,2,0,"" +"tt_content" +,"uid","pid","CType","header","sorting","sys_language_uid","colPos","tx_container_parent","l18n_parent","l10n_source" +,1,1,"b13-2cols","",256,0,0,0,0,0 +,2,1,"b13-2cols","",512,1,0,0,1,1 +,3,1,"header","",320,0,0,0,0,0 +,4,1,"header"," (copy 1)",768,1,0,0,3,3 diff --git a/Tests/Functional/Datahandler/Localization/Fixtures/Localize/LocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv b/Tests/Functional/Datahandler/Localization/Fixtures/Localize/LocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv index 125799b6..d5efbef4 100644 --- a/Tests/Functional/Datahandler/Localization/Fixtures/Localize/LocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv +++ b/Tests/Functional/Datahandler/Localization/Fixtures/Localize/LocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv @@ -7,4 +7,4 @@ ,1,1,"b13-2cols","",256,0,0,0,0,0 ,2,1,"b13-2cols","",512,1,0,0,1,1 ,3,1,"header","",320,0,0,0,0,0 -,4,1,"header"," (copy 1)",768,1,0,0,3,3 +,4,1,"header","",768,1,0,0,3,3 diff --git a/Tests/Functional/Datahandler/Localization/FreeMode/ContainerTest.php b/Tests/Functional/Datahandler/Localization/FreeMode/ContainerTest.php index 5a7f5314..ad64fed9 100644 --- a/Tests/Functional/Datahandler/Localization/FreeMode/ContainerTest.php +++ b/Tests/Functional/Datahandler/Localization/FreeMode/ContainerTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class ContainerTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function deleteContainerDeleteChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/DeleteContainerDeleteChildren.csv'); @@ -34,9 +33,7 @@ public function deleteContainerDeleteChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/DeleteContainerDeleteChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerToOtherPageMovesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToOtherPageMovesChildren.csv'); @@ -60,9 +57,7 @@ public function moveContainerToOtherPageMovesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToOtherPageMovesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerCopiesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerCopiesChildren.csv'); @@ -84,9 +79,7 @@ public function copyContainerCopiesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerCopiesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerToOtherLanguageCopiesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToOtherLanguageCopiesChildren.csv'); @@ -109,9 +102,7 @@ public function copyContainerToOtherLanguageCopiesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToOtherLanguageCopiesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerToDefaultLanguage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToDefaultLanguage.csv'); @@ -134,9 +125,7 @@ public function copyContainerToDefaultLanguage(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToDefaultLanguageResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerToOtherLanguageCopiesNestedChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToOtherLanguageCopiesNestedChildren.csv'); @@ -159,9 +148,7 @@ public function copyContainerToOtherLanguageCopiesNestedChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerToOtherLanguageCopiesNestedChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerToOtherLanguageMovesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToOtherLanguageMovesChildren.csv'); @@ -185,9 +172,7 @@ public function moveContainerToOtherLanguageMovesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToOtherLanguageMovesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function moveContainerToDefaultLanguage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Container/MoveContainerToDefaultLanguage.csv'); diff --git a/Tests/Functional/Datahandler/Localization/FreeMode/CopyElementOtherPageTest.php b/Tests/Functional/Datahandler/Localization/FreeMode/CopyElementOtherPageTest.php index 5dbdeb28..d9a832bc 100644 --- a/Tests/Functional/Datahandler/Localization/FreeMode/CopyElementOtherPageTest.php +++ b/Tests/Functional/Datahandler/Localization/FreeMode/CopyElementOtherPageTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class CopyElementOtherPageTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function copyChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -43,9 +42,7 @@ public function copyChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -71,9 +68,7 @@ public function copyChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -99,9 +94,7 @@ public function copyChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -126,9 +119,7 @@ public function copyChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); @@ -154,9 +145,7 @@ public function copyElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/CopyElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElementOtherPage/setup.csv'); diff --git a/Tests/Functional/Datahandler/Localization/FreeMode/CopyElementTest.php b/Tests/Functional/Datahandler/Localization/FreeMode/CopyElementTest.php index 962e5549..002c3fd1 100644 --- a/Tests/Functional/Datahandler/Localization/FreeMode/CopyElementTest.php +++ b/Tests/Functional/Datahandler/Localization/FreeMode/CopyElementTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class CopyElementTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function copyChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -43,9 +42,7 @@ public function copyChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -71,9 +68,7 @@ public function copyChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -99,9 +94,7 @@ public function copyChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -126,9 +119,7 @@ public function copyChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); @@ -154,9 +145,7 @@ public function copyElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyElement/CopyElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function copyElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyElement/setup.csv'); diff --git a/Tests/Functional/Datahandler/Localization/FreeMode/MoveElementOtherPageTest.php b/Tests/Functional/Datahandler/Localization/FreeMode/MoveElementOtherPageTest.php index fa5cf206..d335dd7e 100644 --- a/Tests/Functional/Datahandler/Localization/FreeMode/MoveElementOtherPageTest.php +++ b/Tests/Functional/Datahandler/Localization/FreeMode/MoveElementOtherPageTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class MoveElementOtherPageTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -43,9 +42,7 @@ public function moveChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -71,9 +68,7 @@ public function moveChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -99,9 +94,7 @@ public function moveChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -126,9 +119,7 @@ public function moveChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); @@ -154,9 +145,7 @@ public function moveElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/MoveElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElementOtherPage/setup.csv'); diff --git a/Tests/Functional/Datahandler/Localization/FreeMode/MoveElementTest.php b/Tests/Functional/Datahandler/Localization/FreeMode/MoveElementTest.php index 96bbd692..c3e1c80f 100644 --- a/Tests/Functional/Datahandler/Localization/FreeMode/MoveElementTest.php +++ b/Tests/Functional/Datahandler/Localization/FreeMode/MoveElementTest.php @@ -13,12 +13,11 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; class MoveElementTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -43,9 +42,7 @@ public function moveChildElementOutsideContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementOutsideContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementOutsideContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -71,9 +68,7 @@ public function moveChildElementOutsideContainerAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementOutsideContainerAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -99,9 +94,7 @@ public function moveChildElementToOtherColumnTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementToOtherColumnTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildElementToOtherColumnAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -126,9 +119,7 @@ public function moveChildElementToOtherColumnAfterElement(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveChildElementToOtherColumnAfterElementResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAtTop(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); @@ -154,9 +145,7 @@ public function moveElementIntoContainerAtTop(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveElement/MoveElementIntoContainerAtTopResult.csv'); } - /** - * @test - */ + #[Test] public function moveElementIntoContainerAfterElement(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveElement/setup.csv'); diff --git a/Tests/Functional/Datahandler/Localization/FreeMode/NewElementTest.php b/Tests/Functional/Datahandler/Localization/FreeMode/NewElementTest.php index 226d209e..5f77522e 100644 --- a/Tests/Functional/Datahandler/Localization/FreeMode/NewElementTest.php +++ b/Tests/Functional/Datahandler/Localization/FreeMode/NewElementTest.php @@ -13,13 +13,12 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Utility\StringUtility; class NewElementTest extends AbstractDatahandler { - /** - * @test - */ + #[Test] public function newElementAfterContainerSortElementAfterLastChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/NewElement/setup.csv'); diff --git a/Tests/Functional/Datahandler/Localization/LocalizeTest.php b/Tests/Functional/Datahandler/Localization/LocalizeTest.php index 88429096..ba39d313 100644 --- a/Tests/Functional/Datahandler/Localization/LocalizeTest.php +++ b/Tests/Functional/Datahandler/Localization/LocalizeTest.php @@ -13,18 +13,13 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; +use TYPO3\CMS\Core\Information\Typo3Version; class LocalizeTest extends AbstractDatahandler { - protected function setUp(): void - { - parent::setUp(); - $this->linkSiteConfigurationIntoTestInstance(); - } - - /** - * @test - */ + #[Test] public function copyChildToLanguageFixContainerParent(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/CopyChildToLanguageFixContainerParent.csv'); @@ -41,9 +36,7 @@ public function copyChildToLanguageFixContainerParent(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/CopyChildToLanguageFixContainerParentResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerToLanguageCopiesChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/CopyContainerToLanguageCopiesChildren.csv'); @@ -60,9 +53,7 @@ public function copyContainerToLanguageCopiesChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/CopyContainerToLanguageCopiesChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function localizeContainerLocalizeChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeContainerLocalizeChildren.csv'); @@ -78,9 +69,7 @@ public function localizeContainerLocalizeChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeContainerLocalizeChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function localizeNestedContainerKeepsDefaultLanguageParent(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeNestedContainerKeepsDefaultLanguageParent.csv'); @@ -96,9 +85,7 @@ public function localizeNestedContainerKeepsDefaultLanguageParent(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeNestedContainerKeepsDefaultLanguageParentResult.csv'); } - /** - * @test - */ + #[Test] public function localizeContainerFromNonDefaultLanguageLocalizeChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeContainerFromNonDefaultLanguageLocalizeChildren.csv'); @@ -114,9 +101,7 @@ public function localizeContainerFromNonDefaultLanguageLocalizeChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeContainerFromNonDefaultLanguageLocalizeChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function copyToLanguageContainerFromNonDefaultLanguageLocalizeChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/CopyToLanguageContainerFromNonDefaultLanguageLocalizeChildren.csv'); @@ -132,9 +117,7 @@ public function copyToLanguageContainerFromNonDefaultLanguageLocalizeChildren(): self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/CopyToLanguageContainerFromNonDefaultLanguageLocalizeChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function copyToLanguageContainerFromNonDefaultLanguageLocalizeChildrenWhenCopiedFromFreeMode(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/CopyToLanguageContainerFromNonDefaultLanguageLocalizeChildrenWhenCopiedFromFreeMode.csv'); @@ -150,9 +133,7 @@ public function copyToLanguageContainerFromNonDefaultLanguageLocalizeChildrenWhe self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/CopyToLanguageContainerFromNonDefaultLanguageLocalizeChildrenWhenCopiedFromFreeModeResult.csv'); } - /** - * @test - */ + #[Test] public function localizeChildFailedIfContainerIsInFreeMode(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeChildFailedIfContainerIsInFreeMode.csv'); @@ -169,9 +150,7 @@ public function localizeChildFailedIfContainerIsInFreeMode(): void self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log is empty'); } - /** - * @test - */ + #[Test] public function localizeChildFailedIfContainerIsNotTranslated(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeChildFailedIfContainerIsNotTranslated.csv'); @@ -188,9 +167,7 @@ public function localizeChildFailedIfContainerIsNotTranslated(): void self::assertNotEmpty($this->dataHandler->errorLog, 'dataHander error log should be empty'); } - /** - * @test - */ + #[Test] public function localizeChildKeepsRelationsIfContainerIsInConnectedMode(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeChildKeepsRelationsIfContainerIsInConnectedMode.csv'); @@ -206,9 +183,6 @@ public function localizeChildKeepsRelationsIfContainerIsInConnectedMode(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeChildKeepsRelationsIfContainerIsInConnectedModeResult.csv'); } - /** - * @return array - */ public static function localizeTwoContainerKeepsParentIndependedOnOrderDataProvider(): array { return [ @@ -233,10 +207,8 @@ public static function localizeTwoContainerKeepsParentIndependedOnOrderDataProvi ]; } - /** - * @test - * @dataProvider localizeTwoContainerKeepsParentIndependedOnOrderDataProvider - */ + #[Test] + #[DataProvider('localizeTwoContainerKeepsParentIndependedOnOrderDataProvider')] public function localizeTwoContainerKeepsParentIndependedOnOrder(array $cmdmap, string $dataset): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeTwoContainerKeepsParentIndependedOnOrder.csv'); @@ -245,9 +217,6 @@ public function localizeTwoContainerKeepsParentIndependedOnOrder(array $cmdmap, self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeTwoContainerKeepsParentIndependedOnOrder' . $dataset . 'Result.csv'); } - /** - * @return array - */ public static function localizeWithCopyTwoContainerChangeParentIndependedOnOrderDataProvider(): array { return [ @@ -272,10 +241,8 @@ public static function localizeWithCopyTwoContainerChangeParentIndependedOnOrder ]; } - /** - * @test - * @dataProvider localizeWithCopyTwoContainerChangeParentIndependedOnOrderDataProvider - */ + #[Test] + #[DataProvider('localizeWithCopyTwoContainerChangeParentIndependedOnOrderDataProvider')] public function localizeWithCopyTwoContainerChangeParentIndependedOnOrder(array $cmdmap, string $dataset): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeWithCopyTwoContainerChangeParentIndependedOnOrder.csv'); @@ -284,9 +251,7 @@ public function localizeWithCopyTwoContainerChangeParentIndependedOnOrder(array self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeWithCopyTwoContainerChangeParentIndependedOnOrder' . $dataset . 'Result.csv'); } - /** - * @test - */ + #[Test] public function localizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Localize/localize_element_after_already_localized_container.csv'); @@ -295,6 +260,10 @@ public function localizeElementAfterAlreadyLocalizedContainerIsSortedAfterContai ]; $this->dataHandler->start([], $cmdmap, $this->backendUser); $this->dataHandler->process_cmdmap(); - self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv'); + if ((new Typo3Version())->getMajorVersion() < 14 || (new Typo3Version())->getBranch() === '14.1') { + self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/LegacyLocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv'); + } else { + self::assertCSVDataSet(__DIR__ . '/Fixtures/Localize/LocalizeElementAfterAlreadyLocalizedContainerIsSortedAfterContainerResult.csv'); + } } } diff --git a/Tests/Functional/Datahandler/Workspace/ContainerTest.php b/Tests/Functional/Datahandler/Workspace/ContainerTest.php index 14b8e223..82d12ae6 100644 --- a/Tests/Functional/Datahandler/Workspace/ContainerTest.php +++ b/Tests/Functional/Datahandler/Workspace/ContainerTest.php @@ -13,6 +13,7 @@ */ use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\WorkspaceAspect; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -30,9 +31,7 @@ protected function setUp(): void $context->setAspect('workspace', $workspaceAspect); } - /** - * @test - */ + #[Test] public function deleteContainerDeleteChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DeleteContainerDeleteChildren.csv'); @@ -48,9 +47,7 @@ public function deleteContainerDeleteChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/DeleteContainerDeleteChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function newVersionDoesNotCreateNewVersionsOfChildren(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/NewVersionDoesNotCreateNewVersionsOfChildren.csv'); @@ -68,9 +65,7 @@ public function newVersionDoesNotCreateNewVersionsOfChildren(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/NewVersionDoesNotCreateNewVersionsOfChildrenResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildsColPosInContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveChildsColPosInContainer.csv'); @@ -93,9 +88,7 @@ public function moveChildsColPosInContainer(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveChildsColPosInContainerResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildOutsideContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveChildOutsideContainer.csv'); @@ -119,9 +112,7 @@ public function moveChildOutsideContainer(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveChildOutsideContainerResult.csv'); } - /** - * @test - */ + #[Test] public function moveChildsColPosInOtherContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveChildsColPosInOtherContainer.csv'); @@ -145,9 +136,7 @@ public function moveChildsColPosInOtherContainer(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveChildsColPosInOtherContainerResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildsColPosInContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyChildsColPosInContainer.csv'); @@ -171,9 +160,7 @@ public function copyChildsColPosInContainer(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyChildsColPosInContainerResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildOutsideContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyChildOutsideContainer.csv'); @@ -198,9 +185,7 @@ public function copyChildOutsideContainer(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyChildOutsideContainerResult.csv'); } - /** - * @test - */ + #[Test] public function copyChildsColPosInOtherContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyChildsColPosInOtherContainer.csv'); @@ -224,9 +209,7 @@ public function copyChildsColPosInOtherContainer(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyChildsColPosInOtherContainerResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyContainer.csv'); @@ -248,9 +231,7 @@ public function copyContainer(): void self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyContainerResult.csv'); } - /** - * @test - */ + #[Test] public function moveRecordInColPosCreatesWorkspaceElementInContainer() { $this->importCSVDataSet(__DIR__ . '/Fixtures/MoveRecordInColPosCreatesWorkspaceElementInContainer.csv'); @@ -274,9 +255,7 @@ public function moveRecordInColPosCreatesWorkspaceElementInContainer() self::assertCSVDataSet(__DIR__ . '/Fixtures/MoveRecordInColPosCreatesWorkspaceElementInContainerResult.csv'); } - /** - * @test - */ + #[Test] public function copyContainerWithChildHasDeletedPlaceholderInWorkspaceDoNotCopyThisChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyContainerWithChildHasDeletedPlaceholderInWorkspaceDoNotCopyThisChild.csv'); @@ -298,9 +277,7 @@ public function copyContainerWithChildHasDeletedPlaceholderInWorkspaceDoNotCopyT self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyContainerWithChildHasDeletedPlaceholderInWorkspaceDoNotCopyThisChildResult.csv'); } - /** - * @test - */ + #[Test] public function deleteContainerWithChildHasDeletedPlaceholderInWorkspaceDoNotDiscardThisChild(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/DeleteContainerWithChildHasDeletedPlaceholderInWorkspaceDoNotDiscardThisChild.csv'); diff --git a/Tests/Functional/Domain/Factory/PageView/Backend/ContainerFactoryTest.php b/Tests/Functional/Domain/Factory/PageView/Backend/ContainerFactoryTest.php index 8c15c8bc..00f09bb2 100644 --- a/Tests/Functional/Domain/Factory/PageView/Backend/ContainerFactoryTest.php +++ b/Tests/Functional/Domain/Factory/PageView/Backend/ContainerFactoryTest.php @@ -11,6 +11,7 @@ */ use B13\Container\Domain\Factory\PageView\Backend\ContainerFactory; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\LanguageAspect; use TYPO3\CMS\Core\Context\WorkspaceAspect; @@ -19,26 +20,18 @@ class ContainerFactoryTest extends FunctionalTestCase { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', ]; - /** - * @var non-empty-string[] - */ protected array $coreExtensionsToLoad = ['workspaces']; - /** - * @test - */ + #[Test] public function localizedContainerChildElementsHasSortingOfDefaultChildElements(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContainerFactory/localizedContainerChildElementsHasSortingOfDefaultChildElements.csv'); - $containerFactory = GeneralUtility::makeInstance(ContainerFactory::class); + $containerFactory = $this->get(ContainerFactory::class); $container = $containerFactory->buildContainer(2); $children = $container->getChildrenByColPos(201); self::assertSame(2, count($children)); @@ -46,15 +39,13 @@ public function localizedContainerChildElementsHasSortingOfDefaultChildElements( self::assertSame(6, $first['uid']); } - /** - * @test - */ + #[Test] public function movedElementIntoOtherContainerInWorkspace(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContainerFactory/movedElementIntoOtherContainerInWorkspace.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 1); GeneralUtility::makeInstance(Context::class)->setAspect('workspace', $workspaceAspect); - $containerFactory = GeneralUtility::makeInstance(ContainerFactory::class); + $containerFactory = $this->get(ContainerFactory::class); $container = $containerFactory->buildContainer(101); $children = $container->getChildrenByColPos(200); self::assertSame(0, count($children)); @@ -65,15 +56,13 @@ public function movedElementIntoOtherContainerInWorkspace(): void self::assertSame(104, $first['uid']); } - /** - * @test - */ + #[Test] public function movedElementIntoContainerInWorkspace(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContainerFactory/movedElementIntoContainerInWorkspace.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 1); GeneralUtility::makeInstance(Context::class)->setAspect('workspace', $workspaceAspect); - $containerFactory = GeneralUtility::makeInstance(ContainerFactory::class); + $containerFactory = $this->get(ContainerFactory::class); $container = $containerFactory->buildContainer(101); $children = $container->getChildrenByColPos(200); self::assertSame(1, count($children)); @@ -82,15 +71,13 @@ public function movedElementIntoContainerInWorkspace(): void self::assertSame(101, $first['tx_container_parent']); } - /** - * @test - */ + #[Test] public function containerRespectSortingOfMovedChildrenInWorkspace(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContainerFactory/movedChildrenInWorkspaceSorting.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 1); GeneralUtility::makeInstance(Context::class)->setAspect('workspace', $workspaceAspect); - $containerFactory = GeneralUtility::makeInstance(ContainerFactory::class); + $containerFactory = $this->get(ContainerFactory::class); $container = $containerFactory->buildContainer(101); $children = $container->getChildrenByColPos(200); self::assertSame(2, count($children)); @@ -100,9 +87,7 @@ public function containerRespectSortingOfMovedChildrenInWorkspace(): void self::assertSame(102, $second['uid']); } - /** - * @test - */ + #[Test] public function containerHoldsMovedChildrenInWorkspaceWithTranslation(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContainerFactory/movedChildrenInWorkspaceWithTranslation.csv'); @@ -110,7 +95,7 @@ public function containerHoldsMovedChildrenInWorkspaceWithTranslation(): void $languageAspect = GeneralUtility::makeInstance(LanguageAspect::class, 1); GeneralUtility::makeInstance(Context::class)->setAspect('workspace', $workspaceAspect); GeneralUtility::makeInstance(Context::class)->setAspect('language', $languageAspect); - $containerFactory = GeneralUtility::makeInstance(ContainerFactory::class); + $containerFactory = $this->get(ContainerFactory::class); $container = $containerFactory->buildContainer(106); $children = $container->getChildrenByColPos(200); self::assertSame(0, count($children)); @@ -121,15 +106,13 @@ public function containerHoldsMovedChildrenInWorkspaceWithTranslation(): void self::assertSame(110, $first['uid']); } - /** - * @test - */ + #[Test] public function containerHoldsCopiedChildrenInWorkspace(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContainerFactory/copiedChildrenInWorkspace.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 1); GeneralUtility::makeInstance(Context::class)->setAspect('workspace', $workspaceAspect); - $containerFactory = GeneralUtility::makeInstance(ContainerFactory::class); + $containerFactory = $this->get(ContainerFactory::class); $container = $containerFactory->buildContainer(101); $children = $container->getChildrenByColPos(200); self::assertSame(1, count($children)); @@ -140,15 +123,13 @@ public function containerHoldsCopiedChildrenInWorkspace(): void self::assertSame(104, $first['uid']); } - /** - * @test - */ + #[Test] public function containerHoldsChildrenWhenMovedToOtherPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContainerFactory/container_moved_to_other_page.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 1); GeneralUtility::makeInstance(Context::class)->setAspect('workspace', $workspaceAspect); - $containerFactory = GeneralUtility::makeInstance(ContainerFactory::class); + $containerFactory = $this->get(ContainerFactory::class); // versioned record uid $container = $containerFactory->buildContainer(203); $children = $container->getChildrenByColPos(201); @@ -157,16 +138,14 @@ public function containerHoldsChildrenWhenMovedToOtherPage(): void self::assertSame(205, $first['uid']); } - /** - * @test - */ + #[Test] public function containerHoldsLocalizedChildrenWhenMovedToOtherPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContainerFactory/container_moved_to_other_page.csv'); $this->importCSVDataSet(__DIR__ . '/Fixture/ContainerFactory/localized_container_moved_to_other_page.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 1); GeneralUtility::makeInstance(Context::class)->setAspect('workspace', $workspaceAspect); - $containerFactory = GeneralUtility::makeInstance(ContainerFactory::class); + $containerFactory = $this->get(ContainerFactory::class); // versioned record uid $container = $containerFactory->buildContainer(213); $children = $container->getChildrenByColPos(201); diff --git a/Tests/Functional/Domain/Factory/PageView/Backend/ContentStorageTest.php b/Tests/Functional/Domain/Factory/PageView/Backend/ContentStorageTest.php index 481583ec..bcb8a608 100644 --- a/Tests/Functional/Domain/Factory/PageView/Backend/ContentStorageTest.php +++ b/Tests/Functional/Domain/Factory/PageView/Backend/ContentStorageTest.php @@ -12,6 +12,7 @@ use B13\Container\Domain\Factory\Database; use B13\Container\Domain\Factory\PageView\Backend\ContentStorage; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\WorkspaceAspect; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -19,28 +20,20 @@ class ContentStorageTest extends FunctionalTestCase { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', ]; - /** - * @var non-empty-string[] - */ protected array $coreExtensionsToLoad = ['workspaces']; - /** - * @test - */ + #[Test] public function getContainerChildrenReturnsAllLiveChildrenInDraftWorkspace(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContentStorage/localizedContainerChildElementsHasSortingOfDefaultChildElements.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 1); - $database = GeneralUtility::makeInstance(Database::class); + $database = $this->get(Database::class); $context = GeneralUtility::makeInstance(Context::class); $context->setAspect('workspace', $workspaceAspect); $contentStorage = GeneralUtility::makeInstance(ContentStorage::class, $database, $context); @@ -49,14 +42,12 @@ public function getContainerChildrenReturnsAllLiveChildrenInDraftWorkspace(): vo self::assertSame(2, count($children)); } - /** - * @test - */ + #[Test] public function getContainerChildrenReturnsAllLiveChildrenInLiveWorkspace(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContentStorage/localizedContainerChildElementsHasSortingOfDefaultChildElements.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 0); - $database = GeneralUtility::makeInstance(Database::class); + $database = $this->get(Database::class); $context = GeneralUtility::makeInstance(Context::class); $context->setAspect('workspace', $workspaceAspect); $contentStorage = GeneralUtility::makeInstance(ContentStorage::class, $database, $context); @@ -65,15 +56,13 @@ public function getContainerChildrenReturnsAllLiveChildrenInLiveWorkspace(): voi self::assertSame(2, count($children)); } - /** - * @test - */ + #[Test] public function deletedChildInWorkspaceReturnsChildInLiveWorkspace(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContentStorage/deletedChildInWorkspace.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 0); - $database = GeneralUtility::makeInstance(Database::class); + $database = $this->get(Database::class); $context = GeneralUtility::makeInstance(Context::class); $context->setAspect('workspace', $workspaceAspect); $contentStorage = GeneralUtility::makeInstance(ContentStorage::class, $database, $context); @@ -82,15 +71,13 @@ public function deletedChildInWorkspaceReturnsChildInLiveWorkspace(): void self::assertSame(1, count($children)); } - /** - * @test - */ + #[Test] public function deletedChildInWorkspaceReturnsNoChildInDraftWorkspace(): void { $this->importCSVDataSet(__DIR__ . '/Fixture/ContentStorage/deletedChildInWorkspace.csv'); $workspaceAspect = GeneralUtility::makeInstance(WorkspaceAspect::class, 1); - $database = GeneralUtility::makeInstance(Database::class); + $database = $this->get(Database::class); $context = GeneralUtility::makeInstance(Context::class); $context->setAspect('workspace', $workspaceAspect); $contentStorage = GeneralUtility::makeInstance(ContentStorage::class, $database, $context); diff --git a/Tests/Functional/Frontend/AbstractFrontend.php b/Tests/Functional/Frontend/AbstractFrontend.php index 408d0ba2..b845434a 100644 --- a/Tests/Functional/Frontend/AbstractFrontend.php +++ b/Tests/Functional/Frontend/AbstractFrontend.php @@ -30,30 +30,17 @@ abstract class AbstractFrontend extends FunctionalTestCase ], ]; - /** - * @var non-empty-string[] - */ protected array $coreExtensionsToLoad = ['core', 'frontend', 'workspaces', 'fluid_styled_content']; - /** - * @var array - */ protected array $pathsToLinkInTestInstance = [ 'typo3conf/ext/container/Build/sites' => 'typo3conf/sites', ]; - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', ]; - /** - * @param string $string - * @return string - */ protected function prepareContent(string $string): string { $lines = explode("\n", $string); diff --git a/Tests/Functional/Frontend/DataProcessorWithDataTest.php b/Tests/Functional/Frontend/DataProcessorWithDataTest.php index ae987a04..5dc7e722 100644 --- a/Tests/Functional/Frontend/DataProcessorWithDataTest.php +++ b/Tests/Functional/Frontend/DataProcessorWithDataTest.php @@ -12,6 +12,8 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class DataProcessorWithDataTest extends AbstractFrontend @@ -32,10 +34,8 @@ protected function setUp(): void ); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function modHeaderIsRendered(): void { $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); diff --git a/Tests/Functional/Frontend/DataProcessorWithFilesTest.php b/Tests/Functional/Frontend/DataProcessorWithFilesTest.php index 1f08f6b7..b964f7d5 100644 --- a/Tests/Functional/Frontend/DataProcessorWithFilesTest.php +++ b/Tests/Functional/Frontend/DataProcessorWithFilesTest.php @@ -12,6 +12,8 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class DataProcessorWithFilesTest extends AbstractFrontend @@ -32,10 +34,8 @@ protected function setUp(): void ); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function relationIsRendered(): void { $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); diff --git a/Tests/Functional/Frontend/DataProcessorWithIrreTest.php b/Tests/Functional/Frontend/DataProcessorWithIrreTest.php index c90929ae..43b05458 100644 --- a/Tests/Functional/Frontend/DataProcessorWithIrreTest.php +++ b/Tests/Functional/Frontend/DataProcessorWithIrreTest.php @@ -10,6 +10,8 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class DataProcessorWithIrreTest extends AbstractFrontend @@ -30,10 +32,8 @@ public function setUp(): void ); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function relationIsRendered(): void { $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); @@ -42,10 +42,8 @@ public function relationIsRendered(): void self::assertStringContainsString('irre-title-default', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function translatedRelationIsRendered(): void { $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/de')); diff --git a/Tests/Functional/Frontend/DefaultLanguageTest.php b/Tests/Functional/Frontend/DefaultLanguageTest.php index e85ad1f0..7b0a0e58 100644 --- a/Tests/Functional/Frontend/DefaultLanguageTest.php +++ b/Tests/Functional/Frontend/DefaultLanguageTest.php @@ -10,14 +10,14 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class DefaultLanguageTest extends AbstractFrontend { - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function childrenAreRendered(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/default_language.csv'); @@ -39,10 +39,8 @@ public function childrenAreRendered(): void self::assertStringContainsString('

left-side-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function childrenAreRenderedAsSorted(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/ContainerWithTwoChildren.csv'); @@ -62,10 +60,8 @@ public function childrenAreRenderedAsSorted(): void self::assertStringContainsString('
first child
second child
', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function canRenderContainerFromOtherPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/ContainerFromOtherPage.csv'); @@ -84,10 +80,8 @@ public function canRenderContainerFromOtherPage(): void self::assertStringContainsString('

left side (201)

child
importCSVDataSet(__DIR__ . '/Fixtures/default_language.csv'); diff --git a/Tests/Functional/Frontend/LanguageFallbackTest.php b/Tests/Functional/Frontend/LanguageFallbackTest.php index 2ca6d2ff..371c57b8 100644 --- a/Tests/Functional/Frontend/LanguageFallbackTest.php +++ b/Tests/Functional/Frontend/LanguageFallbackTest.php @@ -10,6 +10,8 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class LanguageFallbackTest extends AbstractFrontend @@ -27,10 +29,8 @@ protected function setUp(): void ); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function nothingTranslated(): void { $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/fr')); @@ -45,10 +45,8 @@ public function nothingTranslated(): void self::assertStringContainsString('

header-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function bothTranslated(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/LanguageFallback/tt_content_both_translated.csv'); @@ -64,10 +62,8 @@ public function bothTranslated(): void self::assertStringNotContainsString('

header-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function fallbackForStrictLanguageToOtherTranslationFreeMode(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/LanguageFallback/tt_content_fallback_for_strict_language_to_other_translation_free_mode.csv'); @@ -83,10 +79,8 @@ public function fallbackForStrictLanguageToOtherTranslationFreeMode(): void self::assertStringNotContainsString('

header-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function bothTranslatedTranslatedChildHidden(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/LanguageFallback/tt_content_both_translated_tranlated_child_hidden.csv'); @@ -102,10 +96,8 @@ public function bothTranslatedTranslatedChildHidden(): void self::assertStringContainsString('

header-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function childTranslated(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/LanguageFallback/tt_content_child_translated.csv'); @@ -121,10 +113,8 @@ public function childTranslated(): void self::assertStringNotContainsString('

header-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function containerTranslated(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/LanguageFallback/tt_content_container_translated.csv'); diff --git a/Tests/Functional/Frontend/LanguageStrictTest.php b/Tests/Functional/Frontend/LanguageStrictTest.php index 69bca714..7e1f6aba 100644 --- a/Tests/Functional/Frontend/LanguageStrictTest.php +++ b/Tests/Functional/Frontend/LanguageStrictTest.php @@ -10,6 +10,8 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class LanguageStrictTest extends AbstractFrontend @@ -27,10 +29,8 @@ protected function setUp(): void ); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function nothingTranslated(): void { $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/de')); @@ -45,10 +45,8 @@ public function nothingTranslated(): void self::assertStringNotContainsString('

header-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function bothTranslated(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/LanguageStrict/tt_content_both_translated.csv'); @@ -64,10 +62,8 @@ public function bothTranslated(): void self::assertStringNotContainsString('

header-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function bothTranslatedTranslatedChildHidden(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/LanguageStrict/tt_content_both_translated_tranlated_child_hidden.csv'); @@ -83,10 +79,8 @@ public function bothTranslatedTranslatedChildHidden(): void self::assertStringNotContainsString('

header-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function childTranslated(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/LanguageStrict/tt_content_child_translated.csv'); @@ -102,10 +96,8 @@ public function childTranslated(): void self::assertStringNotContainsString('

header-default

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function containerTranslated(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/LanguageStrict/tt_content_container_translated.csv'); diff --git a/Tests/Functional/Frontend/SiteLanguageFreeTest.php b/Tests/Functional/Frontend/SiteLanguageFreeTest.php index b8319498..1d8b14b1 100644 --- a/Tests/Functional/Frontend/SiteLanguageFreeTest.php +++ b/Tests/Functional/Frontend/SiteLanguageFreeTest.php @@ -10,6 +10,8 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class SiteLanguageFreeTest extends AbstractFrontend @@ -27,10 +29,8 @@ protected function setUp(): void ); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function containerTranslatedInFreeModeSiteConfiguration(): void { $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/en-free')); diff --git a/Tests/Functional/Frontend/WorkspaceTest.php b/Tests/Functional/Frontend/WorkspaceTest.php index 5b8ae3bb..a81ca546 100644 --- a/Tests/Functional/Frontend/WorkspaceTest.php +++ b/Tests/Functional/Frontend/WorkspaceTest.php @@ -10,6 +10,8 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext; @@ -29,10 +31,8 @@ protected function setUp(): void ); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function childInLiveIsRendered(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Workspace/container_with_ws_child.csv'); @@ -43,10 +43,8 @@ public function childInLiveIsRendered(): void self::assertStringNotContainsString('

header-ws

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function childInWorkspaceIsRendered(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Workspace/container_with_ws_child.csv'); @@ -58,10 +56,8 @@ public function childInWorkspaceIsRendered(): void self::assertStringNotContainsString('

header-live

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function childInWorkspaceIsRenderedIfMovedFromOutsideContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Workspace/container_with_ws_child_moved_from_outside.csv'); @@ -73,10 +69,8 @@ public function childInWorkspaceIsRenderedIfMovedFromOutsideContainer(): void self::assertStringNotContainsString('

header-live

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function childInWorkspaceIsRenderendIfContainerIsMovedToOtherPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Workspace/other_page.csv'); @@ -88,10 +82,8 @@ public function childInWorkspaceIsRenderendIfContainerIsMovedToOtherPage(): void self::assertStringContainsString('

header-ws

', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function containerInWorkspaceIsRenderedWhenLiveVersionIsHidden(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Workspace/container_in_ws_whith_hidden_live_version.csv'); @@ -104,10 +96,8 @@ public function containerInWorkspaceIsRenderedWhenLiveVersionIsHidden(): void self::assertStringNotContainsString('live-container-header', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function childInWorkspaceIsRenderedWhenLiveVersionIsHidden(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Workspace/child_in_ws_whith_hidden_live_version.csv'); @@ -120,10 +110,8 @@ public function childInWorkspaceIsRenderedWhenLiveVersionIsHidden(): void self::assertStringNotContainsString('live-child-header', $body); } - /** - * @test - * @group frontend - */ + #[Test] + #[Group('frontend')] public function localizedChildInWorkspaceIsRenderendIfContainerWithLocalizationIsMovedToOtherPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Workspace/other_page.csv'); diff --git a/Tests/Functional/Hooks/UsedRecordsTest.php b/Tests/Functional/Hooks/UsedRecordsTest.php deleted file mode 100644 index 94738ad0..00000000 --- a/Tests/Functional/Hooks/UsedRecordsTest.php +++ /dev/null @@ -1,134 +0,0 @@ -getMajorVersion() >= 12) { - self::markTestSkipped('>= v12 is tested by Listener ContentUsedOnPageTest'); - } - $this->importCSVDataSet(__DIR__ . '/Fixtures/UsedRecords/children_in_container.csv'); - $pageLayout = $this->getPageLayoutView(); - $usedRecords = GeneralUtility::makeInstance(UsedRecords::class); - $record = $this->fetchOneRecordByUid(2); - $res = $usedRecords->addContainerChildren(['record' => $record, 'used' => false], $pageLayout); - self::assertTrue($res); - } - - /** - * @test - */ - public function addContainerChildrenReturnsFalseIfChildrenHasWrongPid(): void - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - self::markTestSkipped('>= v12 is tested by Listener ContentUsedOnPageTest'); - } - $this->importCSVDataSet(__DIR__ . '/Fixtures/UsedRecords/children_in_container_wrong_pid.csv'); - $pageLayout = $this->getPageLayoutView(); - $usedRecords = GeneralUtility::makeInstance(UsedRecords::class); - $record = $this->fetchOneRecordByUid(2); - $res = $usedRecords->addContainerChildren(['record' => $record, 'used' => false], $pageLayout); - self::assertFalse($res); - } - - /** - * @test - */ - public function addContainerChildrenReturnsFalseIfChildrenHasWrongColPos(): void - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - self::markTestSkipped('>= v12 is tested by Listener ContentUsedOnPageTest'); - } - $this->importCSVDataSet(__DIR__ . '/Fixtures/UsedRecords/children_in_container_wrong_colpos.csv'); - $pageLayout = $this->getPageLayoutView(); - $usedRecords = GeneralUtility::makeInstance(UsedRecords::class); - $record = $this->fetchOneRecordByUid(2); - $res = $usedRecords->addContainerChildren(['record' => $record, 'used' => false], $pageLayout); - self::assertFalse($res); - } - - /** - * @test - */ - public function addContainerChildrenReturnsFalseIfRecordNotInContainer(): void - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - self::markTestSkipped('>= v12 is tested by Listener ContentUsedOnPageTest'); - } - $this->importCSVDataSet(__DIR__ . '/Fixtures/UsedRecords/children_not_in_container.csv'); - $pageLayout = $this->getPageLayoutView(); - $usedRecords = GeneralUtility::makeInstance(UsedRecords::class); - $record = $this->fetchOneRecordByUid(2); - $res = $usedRecords->addContainerChildren(['record' => $record, 'used' => false], $pageLayout); - self::assertFalse($res); - } - - /** - * @test - */ - public function addContainerChildrenReturnsTrueForLocalizedContent(): void - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - self::markTestSkipped('>= v12 is tested by Listener ContentUsedOnPageTest'); - } - $this->importCSVDataSet(__DIR__ . '/Fixtures/UsedRecords/localized_content.csv'); - $pageLayout = $this->getPageLayoutView(); - $usedRecords = GeneralUtility::makeInstance(UsedRecords::class); - $record = $this->fetchOneRecordByUid(4); - $res = $usedRecords->addContainerChildren(['record' => $record, 'used' => false], $pageLayout); - self::assertTrue($res); - } - - protected function fetchOneRecordByUid(int $uid): array - { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content'); - $row = $queryBuilder->select('*') - ->from('tt_content') - ->where( - $queryBuilder->expr()->eq( - 'uid', - $queryBuilder->createNamedParameter($uid, Connection::PARAM_INT) - ) - ) - ->executeQuery() - ->fetchAssociative(); - self::assertIsArray($row); - return $row; - } -} diff --git a/Tests/Functional/Integrity/IntegrityTest.php b/Tests/Functional/Integrity/IntegrityTest.php index b2a429bf..21243394 100644 --- a/Tests/Functional/Integrity/IntegrityTest.php +++ b/Tests/Functional/Integrity/IntegrityTest.php @@ -15,6 +15,7 @@ use B13\Container\Integrity\Error\WrongPidError; use B13\Container\Integrity\Integrity; use B13\Container\Integrity\IntegrityFix; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Backend\Context\PageContext; use TYPO3\CMS\Backend\Domain\Model\Language\PageLanguageInformation; use TYPO3\CMS\Backend\View\BackendLayout\BackendLayout; @@ -33,21 +34,16 @@ class IntegrityTest extends FunctionalTestCase { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', ]; - /** - * @test - */ + #[Test] public function integrityCreateWrongPidError(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/children_with_wrong_pids.csv'); - $integrity = GeneralUtility::makeInstance(Integrity::class); + $integrity = $this->get(Integrity::class); $res = $integrity->run(); self::assertTrue(isset($res['errors'])); self::assertSame(1, count($res['errors'])); @@ -60,9 +56,7 @@ public function integrityCreateWrongPidError(): void self::assertSame(1, $container['uid']); } - /** - * @test - */ + #[Test] public function wrongPidErrorElementsAreShownAsUnusedElements(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/children_with_wrong_pids.csv'); @@ -87,43 +81,37 @@ public function wrongPidErrorElementsAreShownAsUnusedElements(): void ) ->executeQuery() ->fetchAssociative(); - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 12) { - $pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout); + + $site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock(); + $drawingConfiguration = $this->getMockBuilder(DrawingConfiguration::class)->disableOriginalConstructor()->getMock(); + $serverRequest = $this->getMockBuilder(ServerRequest::class)->disableOriginalConstructor()->getMock(); + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 14) { + $pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout, $site, $drawingConfiguration, $serverRequest); $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(); - 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); - } + $pageLanguageInformation = new PageLanguageInformation( + $pageRecord['uid'], + [], + [], + [], + [0], + false, + [] + ); + $pageContext = new PageContext( + $pageRecord['uid'], + $pageRecord, + $site, + [], + [], + [], + $pageLanguageInformation, + new Permission() + ); + $pageLayoutContext = new PageLayoutContext($pageContext, $backendLayout, $drawingConfiguration, $serverRequest); + $contentFetcher = $this->get(ContentFetcher::class); + $unusedRecords = $contentFetcher->getUnusedRecords($pageLayoutContext); } $unusedRecordsArr = []; @@ -134,17 +122,15 @@ public function wrongPidErrorElementsAreShownAsUnusedElements(): void self::assertSame(2, $unusedRecordsArr[0]['uid']); } - /** - * @test - */ + #[Test] public function integrityFixDeleteChildrenWithWrongPid(): void { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $GLOBALS['BE_USER'] = $this->setUpBackendUser(1); $this->importCSVDataSet(__DIR__ . '/Fixtures/children_with_wrong_pids.csv'); - $integrity = GeneralUtility::makeInstance(Integrity::class); + $integrity = $this->get(Integrity::class); $res = $integrity->run(); - $integrityFix = GeneralUtility::makeInstance(IntegrityFix::class); + $integrityFix = $this->get(IntegrityFix::class); foreach ($res['errors'] as $error) { $integrityFix->deleteChildrenWithWrongPid($error); } diff --git a/Tests/Functional/Integrity/SortingInPageTest.php b/Tests/Functional/Integrity/SortingInPageTest.php index 4c3798e8..d9acafd8 100644 --- a/Tests/Functional/Integrity/SortingInPageTest.php +++ b/Tests/Functional/Integrity/SortingInPageTest.php @@ -17,6 +17,7 @@ use B13\Container\Integrity\Database; use B13\Container\Integrity\SortingInPage; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Localization\LanguageServiceFactory; @@ -25,14 +26,8 @@ class SortingInPageTest extends FunctionalTestCase { - /** - * @var SortingInPage - */ - protected $sorting; + protected ?SortingInPage $sorting = null; - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', @@ -53,9 +48,7 @@ protected function setUp(): void $this->sorting = GeneralUtility::makeInstance(SortingInPage::class, $sortingDatabase, $containerRegistry, $containerFactory, $containerService); } - /** - * @test - */ + #[Test] public function containerIsSortedAfterChildOfPreviousContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/SortingInPage/container_is_sorted_before_child_of_previous_container.csv'); @@ -65,9 +58,7 @@ public function containerIsSortedAfterChildOfPreviousContainer(): void self::assertTrue($rows[2]['sorting'] > $rows[3]['sorting'], 'container should be sorted after child of previous container'); } - /** - * @test - */ + #[Test] public function containerIsSortedAfterChildOfPreviousContainerWithChangedChildrenSorting(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/SortingInPage/container_is_sorted_before_child_of_previous_container_with_changed_children_sorting.csv'); @@ -77,9 +68,7 @@ public function containerIsSortedAfterChildOfPreviousContainerWithChangedChildre self::assertTrue($rows[2]['sorting'] > $rows[3]['sorting'], 'container should be sorted after child of previous container'); } - /** - * @test - */ + #[Test] public function containerIsSortedAfterChildOfPreviousContainerWithNestedChangedChildrenSorting(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/SortingInPage/container_is_sorted_before_child_of_previous_container_with_nested_changed_children_sorting.csv'); @@ -90,9 +79,7 @@ public function containerIsSortedAfterChildOfPreviousContainerWithNestedChangedC self::assertTrue($rows[5]['sorting'] > $rows[4]['sorting'], 'child should be sorted after its own parent container after resorting'); } - /** - * @test - */ + #[Test] public function nothingDoneForAlreadyCorrectSorted(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/SortingInPage/correct_sorted.csv'); diff --git a/Tests/Functional/Integrity/SortingTest.php b/Tests/Functional/Integrity/SortingTest.php index a19d40ae..d985945d 100644 --- a/Tests/Functional/Integrity/SortingTest.php +++ b/Tests/Functional/Integrity/SortingTest.php @@ -17,6 +17,7 @@ use B13\Container\Integrity\Database; use B13\Container\Integrity\Sorting; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Localization\LanguageServiceFactory; @@ -25,14 +26,8 @@ class SortingTest extends FunctionalTestCase { - /** - * @var Sorting - */ - protected $sorting; + protected ?Sorting $sorting = null; - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', @@ -53,9 +48,7 @@ protected function setUp(): void $this->sorting = GeneralUtility::makeInstance(Sorting::class, $sortingDatabase, $containerRegistry, $containerFactory, $containerService); } - /** - * @test - */ + #[Test] public function childBeforeContainerIsSortedAfterContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Sorting/child_is_before_container.csv'); @@ -65,9 +58,7 @@ public function childBeforeContainerIsSortedAfterContainer(): void self::assertTrue($rows[1]['sorting'] < $rows[2]['sorting'], 'child should be sorted after container'); } - /** - * @test - */ + #[Test] public function nestedContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Sorting/nested_container.csv'); @@ -79,9 +70,7 @@ public function nestedContainer(): void self::assertTrue(count($errors) === 1, 'no error is added error'); } - /** - * @test - */ + #[Test] public function childSecondColIsSortedAfterChildInFirstCol(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Sorting/child_in_second_col_is_before_child_in_first_col.csv'); @@ -91,9 +80,7 @@ public function childSecondColIsSortedAfterChildInFirstCol(): void self::assertTrue($rows[3]['sorting'] < $rows[2]['sorting'], 'child in second col should be sorted after child in first col'); } - /** - * @test - */ + #[Test] public function translatedChildInFreeModeBeforeContainerIsSortedAfterContainer(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/Sorting/translated_child_in_free_mode_is_before_container.csv'); diff --git a/Tests/Functional/Integrity/SortingWithContentDefenderTest.php b/Tests/Functional/Integrity/SortingWithContentDefenderTest.php index a2820ca5..043a633f 100644 --- a/Tests/Functional/Integrity/SortingWithContentDefenderTest.php +++ b/Tests/Functional/Integrity/SortingWithContentDefenderTest.php @@ -17,6 +17,8 @@ use B13\Container\Integrity\Database; use B13\Container\Integrity\Sorting; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Localization\LanguageServiceFactory; @@ -25,19 +27,13 @@ class SortingWithContentDefenderTest extends FunctionalTestCase { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', 'typo3conf/ext/content_defender', ]; - /** - * @var Sorting - */ - protected $sorting; + protected ?Sorting $sorting = null; protected function setUp(): void { @@ -54,10 +50,8 @@ protected function setUp(): void $this->sorting = GeneralUtility::makeInstance(Sorting::class, $sortingDatabase, $containerRegistry, $containerFactory, $containerService); } - /** - * @test - * @group content_defender - */ + #[Test] + #[Group('content_defender')] public function childBeforeContainerIsSortedAfterContainerEvenIfCTypeDisallowedByContentDefender(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/SortingWithContentDefender/disallowed_child_is_before_container.csv'); diff --git a/Tests/Functional/Listener/ContentUsedOnPageTest.php b/Tests/Functional/Listener/ContentUsedOnPageTest.php index 9aca8761..74dadcfc 100644 --- a/Tests/Functional/Listener/ContentUsedOnPageTest.php +++ b/Tests/Functional/Listener/ContentUsedOnPageTest.php @@ -13,32 +13,24 @@ */ use B13\Container\Listener\ContentUsedOnPage; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Backend\View\Event\IsContentUsedOnPageLayoutEvent; use TYPO3\CMS\Backend\View\PageLayoutContext; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; class ContentUsedOnPageTest extends FunctionalTestCase { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', ]; - /** - * @test - */ + #[Test] public function addContainerChildrenReturnsTrueIfChildrenInContainer(): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - self::markTestSkipped('< v12 is tested by Hook UsedRecords'); - } $this->importCSVDataSet(__DIR__ . '/../Hooks/Fixtures/UsedRecords/children_in_container.csv'); $pageLayoutContext = $this->getMockBuilder(PageLayoutContext::class)->disableOriginalConstructor()->getMock(); $record = $this->fetchOneRecordByUid(2); @@ -48,14 +40,9 @@ public function addContainerChildrenReturnsTrueIfChildrenInContainer(): void self::assertTrue($event->isRecordUsed()); } - /** - * @test - */ + #[Test] public function addContainerChildrenReturnsFalseIfChildrenHasWrongPid(): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - self::markTestSkipped('< v12 is tested by Hook UsedRecords'); - } $this->importCSVDataSet(__DIR__ . '/../Hooks/Fixtures/UsedRecords/children_in_container_wrong_pid.csv'); $pageLayoutContext = $this->getMockBuilder(PageLayoutContext::class)->disableOriginalConstructor()->getMock(); $record = $this->fetchOneRecordByUid(2); @@ -65,14 +52,9 @@ public function addContainerChildrenReturnsFalseIfChildrenHasWrongPid(): void self::assertFalse($event->isRecordUsed()); } - /** - * @test - */ + #[Test] public function addContainerChildrenReturnsFalseIfChildrenHasWrongColPos(): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - self::markTestSkipped('< v12 is tested by Hook UsedRecords'); - } $this->importCSVDataSet(__DIR__ . '/../Hooks/Fixtures/UsedRecords/children_in_container_wrong_colpos.csv'); $pageLayoutContext = $this->getMockBuilder(PageLayoutContext::class)->disableOriginalConstructor()->getMock(); $record = $this->fetchOneRecordByUid(2); @@ -82,14 +64,9 @@ public function addContainerChildrenReturnsFalseIfChildrenHasWrongColPos(): void self::assertFalse($event->isRecordUsed()); } - /** - * @test - */ + #[Test] public function addContainerChildrenReturnsFalseIfRecordNotInContainer(): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - self::markTestSkipped('< v12 is tested by Hook UsedRecords'); - } $this->importCSVDataSet(__DIR__ . '/../Hooks/Fixtures/UsedRecords/children_not_in_container.csv'); $pageLayoutContext = $this->getMockBuilder(PageLayoutContext::class)->disableOriginalConstructor()->getMock(); $record = $this->fetchOneRecordByUid(2); @@ -99,14 +76,9 @@ public function addContainerChildrenReturnsFalseIfRecordNotInContainer(): void self::assertFalse($event->isRecordUsed()); } - /** - * @test - */ + #[Test] public function addContainerChildrenReturnsTrueForLocalizedContent(): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - self::markTestSkipped('< v12 is tested by Hook UsedRecords'); - } $this->importCSVDataSet(__DIR__ . '/../Hooks/Fixtures/UsedRecords/localized_content.csv'); $pageLayoutContext = $this->getMockBuilder(PageLayoutContext::class)->disableOriginalConstructor()->getMock(); $record = $this->fetchOneRecordByUid(4); diff --git a/Tests/Functional/Listener/RecordSummaryForLocalization.php b/Tests/Functional/Listener/RecordSummaryForLocalization.php index e4c6730f..055be252 100644 --- a/Tests/Functional/Listener/RecordSummaryForLocalization.php +++ b/Tests/Functional/Listener/RecordSummaryForLocalization.php @@ -12,23 +12,19 @@ * of the License, or any later version. */ +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Backend\Controller\Event\AfterRecordSummaryForLocalizationEvent; use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; class RecordSummaryForLocalization extends FunctionalTestCase { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', ]; - /** - * @test - */ + #[Test] public function childrenIsMovedIntoBackendLayoutColPosIfContainerIsAlreadyTranslated(): void { if ((new Typo3Version())->getMajorVersion() < 14) { @@ -59,9 +55,7 @@ public function childrenIsMovedIntoBackendLayoutColPosIfContainerIsAlreadyTransl self::assertSame($expected, $records); } - /** - * @test - */ + #[Test] public function childrenIsNotMovedIntoBackendLayoutColPosIfContainerShouldBeTranslated(): void { if ((new Typo3Version())->getMajorVersion() < 14) { diff --git a/Tests/Functional/Service/RecordLocalizeSummaryModifierTest.php b/Tests/Functional/Service/RecordLocalizeSummaryModifierTest.php index 4e403779..32712c48 100644 --- a/Tests/Functional/Service/RecordLocalizeSummaryModifierTest.php +++ b/Tests/Functional/Service/RecordLocalizeSummaryModifierTest.php @@ -14,22 +14,18 @@ use B13\Container\Service\RecordLocalizeSummaryModifier; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; class RecordLocalizeSummaryModifierTest extends FunctionalTestCase { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', 'typo3conf/ext/container_example', ]; - /** - * @test - */ + #[Test] public function getContainerUidsReturnsAllUids(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/two_container_elements.csv'); @@ -42,9 +38,7 @@ public function getContainerUidsReturnsAllUids(): void self::assertSame(2, count($containerUids)); } - /** - * @test - */ + #[Test] public function getContainerChildrenReturnsHiddenRecords(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/hidden_child_record.csv'); @@ -58,9 +52,7 @@ public function getContainerChildrenReturnsHiddenRecords(): void self::assertIsArray($containerChildren[1]); } - /** - * @test - */ + #[Test] public function getContainerUidsReturnsHiddenUids(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/hidden_container_record.csv'); @@ -73,9 +65,7 @@ public function getContainerUidsReturnsHiddenUids(): void self::assertSame([1], $containerUids); } - /** - * @test - */ + #[Test] public function getContainerUidsReturnsAlsoUidsOfL18nParents(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/container_and_translated_container.csv'); diff --git a/Tests/Functional/Tca/RegistryTest.php b/Tests/Functional/Tca/RegistryTest.php index efb073ef..afd013b8 100644 --- a/Tests/Functional/Tca/RegistryTest.php +++ b/Tests/Functional/Tca/RegistryTest.php @@ -14,23 +14,17 @@ use B13\Container\Tca\ContainerConfiguration; use B13\Container\Tca\Registry; -use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Information\Typo3Version; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; class RegistryTest extends FunctionalTestCase { - /** - * @var non-empty-string[] - */ protected array $testExtensionsToLoad = [ 'typo3conf/ext/container', ]; - /** - * @test - */ + #[Test] public function getPageTsAddsPreviewConfigEvenIfRegisterInNewContentElementWizardIsSetToFalse(): void { // https://github.com/b13/container/pull/153 @@ -51,15 +45,9 @@ public function getPageTsAddsPreviewConfigEvenIfRegisterInNewContentElementWizar self::assertStringContainsString($expected, $pageTs); } - /** - * @test - */ - public function getPageTsStringReturnsGroupAsGroupLabelWhenGroupIsNotAddetToItemGroups(): void + #[Test] + public function getPageTsStringReturnsWizardItemsRemove(): void { - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) { - // s. https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-102834-RemoveItemsFromNewContentElementWizard.html - self::markTestSkipped('new content element wizards removed'); - } \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(Registry::class)->configureContainer( ( new ContainerConfiguration( @@ -68,62 +56,11 @@ public function getPageTsStringReturnsGroupAsGroupLabelWhenGroupIsNotAddetToItem 'bar', // description [] // grid configuration ) - )->setGroup('baz') + )->setRegisterInNewContentElementWizard(false) ); $registry = GeneralUtility::makeInstance(Registry::class); $pageTs = $registry->getPageTsString(); - $expected = 'mod.wizards.newContentElement.wizardItems.baz.header = baz'; + $expected = 'mod.wizards.newContentElement.wizardItems.container.removeItems := addToList(b13-container)'; self::assertStringContainsString($expected, $pageTs); } - - /** - * @test - */ - public function tcaDefaultGroupIsAddedToNewContentElementCommonGroup(): void - { - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) { - // s. https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-102834-RemoveItemsFromNewContentElementWizard.html - self::markTestSkipped('new content element wizards removed'); - } - \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(Registry::class)->configureContainer( - ( - new ContainerConfiguration( - 'b13-container', // CType - 'foo', // label - 'bar', // description - [] // grid configuration - ) - )->setGroup('default') - ); - $registry = GeneralUtility::makeInstance(Registry::class); - $pageTs = $registry->getPageTsString(); - $expected = 'mod.wizards.newContentElement.wizardItems.common.show := addToList(b13-container)'; - self::assertStringContainsString($expected, $pageTs); - } - - /** - * @test - */ - public function originalPageTsIsNotOverriden(): void - { - if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) { - // s. https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-102834-RemoveItemsFromNewContentElementWizard.html - self::markTestSkipped('new content element wizards removed'); - } - $this->importCSVDataSet(__DIR__ . '/Fixtures/original_page_ts_is_not_overridden.csv'); - \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(Registry::class)->configureContainer( - ( - new ContainerConfiguration( - 'b13-container', // CType - 'foo', // label - 'bar', // description - [] // grid configuration - ) - )->setGroup('special') - ); - $pageTsConfig = BackendUtility::getPagesTSconfig(1); - $specialHeader = $pageTsConfig['mod.']['wizards.']['newContentElement.']['wizardItems.']['special.']['header'] ?? ''; - $expected = 'LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:special'; - self::assertSame($expected, $specialHeader); - } } diff --git a/Tests/README.md b/Tests/README.md index a1d188a9..46e1d1e9 100644 --- a/Tests/README.md +++ b/Tests/README.md @@ -17,6 +17,9 @@ .Build/bin/typo3 extension:setup # run php webserver and chromedriver php -S 0.0.0.0:8080 -t .Build/Web/ & + # for TYPO3 14 + cp Build/router.php .Build/Web + php -S 0.0.0.0:8080 -t .Build/Web/ .Build/Web/router.php & chromedriver --url-base=/wd/hub --port=9515 & # create database with "_at" postfix mysql -e 'CREATE DATABASE IF NOT EXISTS foox_at;' @@ -24,6 +27,6 @@ ## Run tests - .Build/bin/phpunit -c Build/phpunit/UnitTests.xml Tests/Unit/ - .Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml Tests/Functional - .Build/bin/codecept run Backend --env=local,classic -c Tests/codeception.yml + php -d memory_limit=2G .Build/bin/phpunit -c Build/phpunit/UnitTests.xml Tests/Unit/ + php -d memory_limit=2G .Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml Tests/Functional + php -d memory_limit=2G .Build/bin/codecept run Backend --env=local,classic -c Tests/codeception.yml diff --git a/Tests/Unit/DataProcessing/ContainerProcessorTest.php b/Tests/Unit/DataProcessing/ContainerProcessorTest.php index 6150df47..4d3f021e 100644 --- a/Tests/Unit/DataProcessing/ContainerProcessorTest.php +++ b/Tests/Unit/DataProcessing/ContainerProcessorTest.php @@ -15,6 +15,7 @@ use B13\Container\DataProcessing\ContainerProcessor; use B13\Container\Domain\Factory\FrontendContainerFactory; use B13\Container\Domain\Model\Container; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; @@ -24,9 +25,7 @@ class ContainerProcessorTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @test - */ + #[Test] public function configuredContentIdIsUsed(): void { $processorConfiguration = ['contentId' => 1]; @@ -44,9 +43,7 @@ public function configuredContentIdIsUsed(): void $containerProcessor->process($contentObjectRenderer, [], $processorConfiguration, []); } - /** - * @test - */ + #[Test] public function configuredContentIdStdWrapIsUsed(): void { $processorConfiguration = ['contentId' => 1, 'contentId.' => 'foo']; @@ -64,9 +61,7 @@ public function configuredContentIdStdWrapIsUsed(): void $containerProcessor->process($contentObjectRenderer, [], $processorConfiguration, []); } - /** - * @test - */ + #[Test] public function canBeCalledWithoutContentId(): void { $processorConfiguration = ['contentId.' => 'foo']; @@ -84,9 +79,7 @@ public function canBeCalledWithoutContentId(): void $containerProcessor->process($contentObjectRenderer, [], $processorConfiguration, []); } - /** - * @test - */ + #[Test] public function nullIsUsedForFactoryIfNoContentIdIsGiven(): void { $processorConfiguration = []; diff --git a/Tests/Unit/Domain/Factory/PageView/Backend/ContainerFactoryTest.php b/Tests/Unit/Domain/Factory/PageView/Backend/ContainerFactoryTest.php index a517ff41..e4aeed5e 100644 --- a/Tests/Unit/Domain/Factory/PageView/Backend/ContainerFactoryTest.php +++ b/Tests/Unit/Domain/Factory/PageView/Backend/ContainerFactoryTest.php @@ -16,6 +16,7 @@ use B13\Container\Domain\Factory\PageView\Backend\ContainerFactory; use B13\Container\Domain\Factory\PageView\Backend\ContentStorage; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Context\Context; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -23,9 +24,7 @@ class ContainerFactoryTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @test - */ + #[Test] public function containerByUidReturnsNullIfNoRecordInDatabaseIsFound(): void { $database = $this->getMockBuilder(Database::class) diff --git a/Tests/Unit/Domain/Service/ContainerServiceTest.php b/Tests/Unit/Domain/Service/ContainerServiceTest.php index 08fb7521..dfa545f5 100644 --- a/Tests/Unit/Domain/Service/ContainerServiceTest.php +++ b/Tests/Unit/Domain/Service/ContainerServiceTest.php @@ -16,6 +16,8 @@ use B13\Container\Domain\Model\Container; use B13\Container\Domain\Service\ContainerService; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -23,12 +25,9 @@ class ContainerServiceTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - protected $allContainerColumns = [200, 201, 202]; + protected array $allContainerColumns = [200, 201, 202]; - /** - * @return array - */ - public static function setupDataProvider() + public static function setupDataProvider(): array { return [ [ @@ -62,10 +61,8 @@ public static function setupDataProvider() ]; } - /** - * @test - * @dataProvider setupDataProvider - */ + #[Test] + #[DataProvider('setupDataProvider')] public function getFirstNewContentElementTargetInColumnTest(array $containerRecord, array $childRecords, int $targetColPos, int $expectedTarget): void { $tcaRegistry = $this->getMockBuilder(Registry::class)->disableOriginalConstructor()->onlyMethods(['getAllAvailableColumnsColPos'])->getMock(); diff --git a/Tests/Unit/Hooks/Datahandler/CommandMapBeforeStartHookTest.php b/Tests/Unit/Hooks/Datahandler/CommandMapBeforeStartHookTest.php index 9a52618f..108af399 100644 --- a/Tests/Unit/Hooks/Datahandler/CommandMapBeforeStartHookTest.php +++ b/Tests/Unit/Hooks/Datahandler/CommandMapBeforeStartHookTest.php @@ -18,15 +18,14 @@ use B13\Container\Hooks\Datahandler\CommandMapBeforeStartHook; use B13\Container\Hooks\Datahandler\Database; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class CommandMapBeforeStartHookTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @test - */ + #[Test] public function rewriteCommandMapTargetForTopAtContainerTest(): void { $containerFactory = $this->getMockBuilder(ContainerFactory::class) @@ -79,9 +78,7 @@ public function rewriteCommandMapTargetForTopAtContainerTest(): void self::assertSame($expected, $rewrittenCommandMap); } - /** - * @test - */ + #[Test] public function rewriteSimpleCommandMapTestForIntoContainer(): void { $copyAfterRecord = [ @@ -127,9 +124,7 @@ public function rewriteSimpleCommandMapTestForIntoContainer(): void self::assertSame($expected, $rewrittenCommandMap); } - /** - * @test - */ + #[Test] public function rewriteSimpleCommandMapTestForAfterContainer(): void { $copyAfterRecord = [ @@ -177,9 +172,7 @@ public function rewriteSimpleCommandMapTestForAfterContainer(): void self::assertSame($expected, $rewrittenCommandMap); } - /** - * @test - */ + #[Test] public function extractContainerIdFromColPosInDatamapSetsContainerIdToSplittedColPosValue(): void { $database = $this->getMockBuilder(Database::class)->getMock(); @@ -220,9 +213,7 @@ public function extractContainerIdFromColPosInDatamapSetsContainerIdToSplittedCo self::assertSame(2, $commandMap['tt_content'][39]['copy']['update']['tx_container_parent']); } - /** - * @test - */ + #[Test] public function extractContainerIdFromColPosInDatamapSetsContainerIdToSplittedColPosValueForDelimiterV12WithMultipleDelimiters(): void { $database = $this->getMockBuilder(Database::class)->getMock(); @@ -250,9 +241,7 @@ public function extractContainerIdFromColPosInDatamapSetsContainerIdToSplittedCo self::assertSame(2, $commandMap['tt_content'][39]['copy']['update']['tx_container_parent']); } - /** - * @test - */ + #[Test] public function extractContainerIdFromColPosInDatamapSetsContainerIdToZeroValue(): void { $database = $this->getMockBuilder(Database::class)->getMock(); diff --git a/Tests/Unit/Hooks/Datahandler/DatamapBeforeStartHookTest.php b/Tests/Unit/Hooks/Datahandler/DatamapBeforeStartHookTest.php index c17dace3..b0361109 100644 --- a/Tests/Unit/Hooks/Datahandler/DatamapBeforeStartHookTest.php +++ b/Tests/Unit/Hooks/Datahandler/DatamapBeforeStartHookTest.php @@ -17,15 +17,14 @@ use B13\Container\Hooks\Datahandler\Database; use B13\Container\Hooks\Datahandler\DatamapBeforeStartHook; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class DatamapBeforeStartHookTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @test - */ + #[Test] public function datamapForLocalizationsExtendsDatamapWithLocalizations(): void { $containerFactory = $this->getMockBuilder(ContainerFactory::class)->disableOriginalConstructor()->getMock(); diff --git a/Tests/Unit/Hooks/UsedRecordsTest.php b/Tests/Unit/Hooks/UsedRecordsTest.php deleted file mode 100644 index fb72661a..00000000 --- a/Tests/Unit/Hooks/UsedRecordsTest.php +++ /dev/null @@ -1,137 +0,0 @@ -getMajorVersion() >= 12) { - self::markTestSkipped('>= v12 is tested by Listener ContentUsedOnPageTest'); - } - $pageLayoutView = $this->getMockBuilder(PageLayoutView::class)->disableOriginalConstructor()->getMock(); - $containerFactory = $this->getMockBuilder(ContainerFactory::class)->disableOriginalConstructor()->getMock(); - $registry = $this->getMockBuilder(Registry::class)->disableOriginalConstructor()->getMock(); - $usedRecords = GeneralUtility::makeInstance(UsedRecords::class, $containerFactory, $registry); - $params = [ - 'used' => true, - 'record' => ['tx_container_parent' => 0], - ]; - self::assertTrue($usedRecords->addContainerChildren($params, $pageLayoutView)); - $params['used'] = false; - self::assertFalse($usedRecords->addContainerChildren($params, $pageLayoutView)); - } - - /** - * @test - */ - public function addContainerChildrenReturnsTrueIfChildrenInContainerColPos(): void - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - self::markTestSkipped('>= v12 is tested by Listener ContentUsedOnPageTest'); - } - $pageLayoutView = $this->getMockBuilder(PageLayoutView::class)->disableOriginalConstructor()->getMock(); - $containerFactory = $this->getMockBuilder(ContainerFactory::class) - ->disableOriginalConstructor() - ->onlyMethods(['buildContainer']) - ->getMock(); - $container = $this->getMockBuilder(Container::class) - ->disableOriginalConstructor() - ->onlyMethods(['getCType', 'hasChildInColPos']) - ->getMock(); - $container->expects(self::once())->method('getCType')->willReturn('myCType'); - $container->expects(self::once())->method('hasChildInColPos')->with(2, 3)->willReturn(true); - $containerFactory->expects(self::once())->method('buildContainer')->with(1)->willReturn($container); - $tcaRegistry = $this->getMockBuilder(Registry::class)->disableOriginalConstructor()->onlyMethods(['getAvailableColumns'])->getMock(); - $tcaRegistry->expects(self::once())->method('getAvailableColumns')->with('myCType')->willReturn([['colPos' => 2]]); - $usedRecords = GeneralUtility::makeInstance(UsedRecords::class, $containerFactory, $tcaRegistry); - $params = [ - 'used' => false, - 'record' => ['tx_container_parent' => 1, 'colPos' => 2, 'uid' => 3, 'sys_language_uid' => 0], - ]; - self::assertTrue($usedRecords->addContainerChildren($params, $pageLayoutView)); - } - - /** - * @test - */ - public function addContainerChildrenReturnsFalseIfChildrenIsNotInContainerColPos(): void - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - self::markTestSkipped('>= v12 is tested by Listener ContentUsedOnPageTest'); - } - $pageLayoutView = $this->getMockBuilder(PageLayoutView::class)->disableOriginalConstructor()->getMock(); - $containerFactory = $this->getMockBuilder(ContainerFactory::class) - ->disableOriginalConstructor() - ->onlyMethods(['buildContainer']) - ->getMock(); - $container = $this->getMockBuilder(Container::class) - ->disableOriginalConstructor() - ->onlyMethods(['getCType', 'hasChildInColPos']) - ->getMock(); - $container->expects(self::once())->method('getCType')->willReturn('myCType'); - $container->expects(self::once())->method('hasChildInColPos')->with(2, 3)->willReturn(false); - $containerFactory->expects(self::once())->method('buildContainer')->with(1)->willReturn($container); - $tcaRegistry = $this->getMockBuilder(Registry::class)->disableOriginalConstructor()->onlyMethods(['getAvailableColumns'])->getMock(); - $tcaRegistry->expects(self::once())->method('getAvailableColumns')->with('myCType')->willReturn([['colPos' => 2]]); - $usedRecords = GeneralUtility::makeInstance(UsedRecords::class, $containerFactory, $tcaRegistry); - $params = [ - 'used' => false, - 'record' => ['tx_container_parent' => 1, 'colPos' => 2, 'uid' => 3, 'sys_language_uid' => 0], - ]; - self::assertFalse($usedRecords->addContainerChildren($params, $pageLayoutView)); - } - - /** - * @test - */ - public function addContainerChildrenReturnsFalseIfChildrenIsNotInRegisterdGrid(): void - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - self::markTestSkipped('>= v12 is tested by Listener ContentUsedOnPageTest'); - } - $pageLayoutView = $this->getMockBuilder(PageLayoutView::class)->disableOriginalConstructor()->getMock(); - $containerFactory = $this->getMockBuilder(ContainerFactory::class) - ->disableOriginalConstructor() - ->onlyMethods(['buildContainer']) - ->getMock(); - $container = $this->getMockBuilder(Container::class) - ->disableOriginalConstructor() - ->onlyMethods(['getCType']) - ->getMock(); - $container->expects(self::once())->method('getCType')->willReturn('myCType'); - $containerFactory->expects(self::once())->method('buildContainer')->with(1)->willReturn($container); - $tcaRegistry = $this->getMockBuilder(Registry::class)->disableOriginalConstructor()->onlyMethods(['getAvailableColumns'])->getMock(); - $tcaRegistry->expects(self::once())->method('getAvailableColumns')->with('myCType')->willReturn([['colPos' => 3]]); - $usedRecords = GeneralUtility::makeInstance(UsedRecords::class, $containerFactory, $tcaRegistry); - $params = [ - 'used' => false, - 'record' => ['tx_container_parent' => 1, 'colPos' => 2, 'uid' => 3], - ]; - self::assertFalse($usedRecords->addContainerChildren($params, $pageLayoutView)); - } -} diff --git a/Tests/Unit/Listener/ContentUsedOnPageTest.php b/Tests/Unit/Listener/ContentUsedOnPageTest.php index 5ffdc3da..e96ab0bc 100644 --- a/Tests/Unit/Listener/ContentUsedOnPageTest.php +++ b/Tests/Unit/Listener/ContentUsedOnPageTest.php @@ -16,9 +16,9 @@ use B13\Container\Domain\Model\Container; use B13\Container\Listener\ContentUsedOnPage; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Backend\View\Event\IsContentUsedOnPageLayoutEvent; use TYPO3\CMS\Backend\View\PageLayoutContext; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -26,14 +26,9 @@ class ContentUsedOnPageTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @test - */ + #[Test] public function addContainerChildrenReturnsUsedOfParamsIfTxContainerParentIsZero(): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - self::markTestSkipped('< v12 is tested by Hook UsedRecords'); - } $containerFactory = $this->getMockBuilder(ContainerFactory::class)->disableOriginalConstructor()->getMock(); $registry = $this->getMockBuilder(Registry::class)->disableOriginalConstructor()->getMock(); $pageLayoutContext = $this->getMockBuilder(PageLayoutContext::class)->disableOriginalConstructor()->getMock(); @@ -46,14 +41,9 @@ public function addContainerChildrenReturnsUsedOfParamsIfTxContainerParentIsZero self::assertFalse($event->isRecordUsed()); } - /** - * @test - */ + #[Test] public function addContainerChildrenReturnsTrueIfChildrenInContainerColPos(): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - self::markTestSkipped('< v12 is tested by Hook UsedRecords'); - } $pageLayoutContext = $this->getMockBuilder(PageLayoutContext::class)->disableOriginalConstructor()->getMock(); $containerFactory = $this->getMockBuilder(ContainerFactory::class) ->disableOriginalConstructor() @@ -75,14 +65,9 @@ public function addContainerChildrenReturnsTrueIfChildrenInContainerColPos(): vo self::assertTrue($event->isRecordUsed()); } - /** - * @test - */ + #[Test] public function addContainerChildrenReturnsFalseIfChildrenIsNotInContainerColPos(): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - self::markTestSkipped('< v12 is tested by Hook UsedRecords'); - } $pageLayoutContext = $this->getMockBuilder(PageLayoutContext::class)->disableOriginalConstructor()->getMock(); $containerFactory = $this->getMockBuilder(ContainerFactory::class) ->disableOriginalConstructor() @@ -104,14 +89,9 @@ public function addContainerChildrenReturnsFalseIfChildrenIsNotInContainerColPos self::assertFalse($event->isRecordUsed()); } - /** - * @test - */ + #[Test] public function addContainerChildrenReturnsFalseIfChildrenIsNotInRegisterdGrid(): void { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - self::markTestSkipped('< v12 is tested by Hook UsedRecords'); - } $pageLayoutContext = $this->getMockBuilder(PageLayoutContext::class)->disableOriginalConstructor()->getMock(); $containerFactory = $this->getMockBuilder(ContainerFactory::class) ->disableOriginalConstructor() diff --git a/Tests/Unit/Service/RecordLocalizeSummaryModifierTest.php b/Tests/Unit/Service/RecordLocalizeSummaryModifierTest.php index 3e3a6290..2227f17b 100644 --- a/Tests/Unit/Service/RecordLocalizeSummaryModifierTest.php +++ b/Tests/Unit/Service/RecordLocalizeSummaryModifierTest.php @@ -14,6 +14,7 @@ use B13\Container\Service\RecordLocalizeSummaryModifier; use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -21,9 +22,7 @@ class RecordLocalizeSummaryModifierTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @test - */ + #[Test] public function filterRecordsRemovesContainerChildrenIfParentContainerIsTranslatedAsWell(): void { if ((new Typo3Version())->getMajorVersion() >= 14) { @@ -47,9 +46,7 @@ public function filterRecordsRemovesContainerChildrenIfParentContainerIsTranslat self::assertTrue(empty($filtered[200])); } - /** - * @test - */ + #[Test] public function filterRecordsKeepsContainerChildrenIfParentContainerIsNotTranslated(): void { if ((new Typo3Version())->getMajorVersion() >= 14) { @@ -73,9 +70,7 @@ public function filterRecordsKeepsContainerChildrenIfParentContainerIsNotTransla self::assertTrue(count($filtered[200]) === 1); } - /** - * @test - */ + #[Test] public function rebuildColumnsReturnsColumnListWithConsecutiveArrayKeysAlsoWhenRegistryReturnsRepeatingColumns(): void { if ((new Typo3Version())->getMajorVersion() >= 14) { diff --git a/Tests/Unit/Tca/RegistryTest.php b/Tests/Unit/Tca/RegistryTest.php index ca20102c..3586f31a 100644 --- a/Tests/Unit/Tca/RegistryTest.php +++ b/Tests/Unit/Tca/RegistryTest.php @@ -13,6 +13,7 @@ */ use B13\Container\Tca\Registry; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\EventDispatcher\NoopEventDispatcher; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -21,9 +22,7 @@ class RegistryTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @test - */ + #[Test] public function getAllAvailableColumnsReturnsEmptyArrayIfNoContainerConfigured(): void { $eventDispatcher = new NoopEventDispatcher(); @@ -32,9 +31,7 @@ public function getAllAvailableColumnsReturnsEmptyArrayIfNoContainerConfigured() self::assertSame([], $columns); } - /** - * @test - */ + #[Test] public function getPageTsStringReturnsEmptyStringIfNoContainerConfigured(): void { $eventDispatcher = new NoopEventDispatcher(); diff --git a/composer.json b/composer.json index 3a7f8290..55ef6636 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "homepage": "https://b13.com", "license": ["GPL-2.0-or-later"], "require": { - "typo3/cms-backend": "^11.5 || ^12.4 || ^13.4 || ^14.0" + "typo3/cms-backend": "^13.4 || ^14.1 || 14.2.x-dev" }, "autoload": { "psr-4": { @@ -16,8 +16,7 @@ "prefer-stable": true, "autoload-dev": { "psr-4": { - "B13\\Container\\Tests\\": "Tests", - "TYPO3\\JsonResponse\\": ".Build/Web/typo3conf/ext/json_response/Classes" + "B13\\Container\\Tests\\": "Tests" } }, "config": { @@ -29,31 +28,24 @@ } }, "require-dev": { - "b13/container-example": "dev-task/v14-backend-template", - "typo3/cms-install": "^11.5 || ^12.4 || ^13.4 || ^14.0", - "typo3/cms-fluid-styled-content": "^11.5 || ^12.4 || ^13.4 || ^14.0", - "typo3/cms-info": "^11.5 || ^12.4 || ^13.4 || ^14.0", - "typo3/cms-workspaces": "^11.5 || ^12.4 || ^13.4 || ^14.0", - "typo3/testing-framework": "^7.1.1 || ^8.2.7 || ^9.1", + "b13/container-example": "dev-task/v4", + "typo3/cms-install": "^13.4 || ^14.1 || 14.2.x-dev", + "typo3/cms-fluid-styled-content": "^13.4 || ^14.1 || 14.2.x-dev", + "typo3/cms-info": "^13.4 || ^14.1 || 14.2.x-dev", + "typo3/cms-workspaces": "^13.4 || ^14.1 || 14.2.x-dev", + "typo3/testing-framework": "^9.1", "phpstan/phpstan": "^1.10", "typo3/coding-standards": "^0.5.5", "friendsofphp/php-cs-fixer": "^3.51", - "codeception/codeception": "^4.1 || ^5.1", - "codeception/module-asserts": "^1.0 || ^3.0", - "codeception/module-webdriver": "^1.0 || ^4.0", - "codeception/module-db": "^1.0 || ^3.1", - "phpunit/phpunit": "9.6 || ^10.5 || ^11.3" + "codeception/codeception": "^5.1", + "codeception/module-asserts": "^3.0", + "codeception/module-webdriver": "^4.0", + "codeception/module-db": "^3.1", + "phpunit/phpunit": "^11.3" }, "replace": { "typo3-ter/container": "self.version" }, - "scripts": { - "prepare-tests": [ - "if [ ! -e .Build/Web/typo3conf/ext/container_example -a -e .Build/Web/typo3conf/ext ]; then cd .Build/Web/typo3conf/ext && ln -s ../../../vendor/b13/container-example container_example && cd -; fi", - "if [ ! -e .Build/Web/typo3conf/ext/content_defender -a -e .Build/vendor/ichhabrecht/content-defender -a -e .Build/Web/typo3conf/ext ]; then cd .Build/Web/typo3conf/ext && ln -s ../../../vendor/ichhabrecht/content-defender content_defender && cd -; fi", - "if [ ! -e .Build/Web/typo3conf/sites -a -e .Build/Web/typo3conf ]; then cd .Build/Web/typo3conf && ln -s ../../../Build/sites && cd -; fi" - ] - }, "extra": { "typo3/cms": { "cms-package-dir": "{$vendor-dir}/typo3/cms", diff --git a/ext_emconf.php b/ext_emconf.php index 2aa7e61b..5ca7385f 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -13,7 +13,7 @@ 'clearCacheOnLoad' => true, 'version' => '3.2.2', 'constraints' => [ - 'depends' => ['typo3' => '11.5.0-14.99.99'], + 'depends' => ['typo3' => '13.4.26-14.99.99'], 'conflicts' => [], 'suggests' => [], ], diff --git a/ext_localconf.php b/ext_localconf.php index 52f87fb4..3ba2014b 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -3,21 +3,6 @@ defined('TYPO3') || die('Access denied.'); call_user_func(static function () { - $typo3Version = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class); - - if ($typo3Version->getMajorVersion() < 12) { - // remove container colPos from "unused" page-elements (v12: IsContentUsedOnPageLayoutEvent) - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['record_is_used']['tx_container'] = - \B13\Container\Hooks\UsedRecords::class . '->addContainerChildren'; - // add tx_container_parent parameter to wizard items (v12: ModifyNewContentElementWizardItemsEvent) - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook']['tx_container'] = - \B13\Container\Hooks\WizardItems::class; - // LocalizationController Xclass (v12: AfterRecordSummaryForLocalizationEvent) - $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\Controller\Page\LocalizationController::class] = [ - 'className' => \B13\Container\Xclasses\LocalizationController::class, - ]; - } - $commandMapHooks = [ 'tx_container-post-process' => \B13\Container\Hooks\Datahandler\CommandMapPostProcessingHook::class, 'tx_container-before-start' => \B13\Container\Hooks\Datahandler\CommandMapBeforeStartHook::class, @@ -52,15 +37,4 @@ $datamapHooks, $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'] ); - - if ($packageManager->isPackageActive('typo3/cms-install') && $typo3Version->getMajorVersion() < 12) { - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][B13\Container\Updates\ContainerMigrateSorting::IDENTIFIER] - = B13\Container\Updates\ContainerMigrateSorting::class; - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][B13\Container\Updates\ContainerDeleteChildrenWithWrongPid::IDENTIFIER] - = B13\Container\Updates\ContainerDeleteChildrenWithWrongPid::class; - } - - if (TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Core\Information\Typo3Version::class)->getMajorVersion() < 12) { - $GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders'][1729106358] = \B13\Container\Backend\ContextMenu\RecordContextMenuItemProvider::class; - } });