Skip to content

Commit 71f02d5

Browse files
committed
[TASK] allow TYPO3 dev-main branch installation
1 parent d059dc3 commit 71f02d5

14 files changed

+287
-25
lines changed

Build/Scripts/runTests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ case ${TEST_SUITE} in
601601
composer require typo3/cms-core:^13.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
602602
composer prepare-tests
603603
else
604-
composer require typo3/cms-core:^12.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
604+
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
605605
composer prepare-tests
606606
fi
607607
"

Build/phpstan-baseline-11-7.4.neon

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,22 @@ parameters:
4040
message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 5 parameters, 2 required\\.$#"
4141
count: 1
4242
path: ../Tests/Functional/Integrity/IntegrityTest.php
43+
-
44+
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface not found\\.$#"
45+
count: 1
46+
path: ../Classes/Backend/Preview/GridRenderer.php
47+
48+
-
49+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryData not found\\.$#"
50+
count: 1
51+
path: ../Classes/Backend/Preview/GridRenderer.php
52+
53+
-
54+
message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#"
55+
count: 1
56+
path: ../Classes/Domain/Factory/ContainerFactory.php
57+
58+
-
59+
message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#"
60+
count: 2
61+
path: ../Classes/Domain/Factory/PageView/Backend/ContentStorage.php

Build/phpstan-baseline-11.neon

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,23 @@ parameters:
4949
message: "#^Attribute class TYPO3\\\\CMS\\\\Install\\\\Attribute\\\\UpgradeWizard does not exist\\.$#"
5050
count: 1
5151
path: ../Classes/Updates/ContainerMigrateSorting.php
52+
53+
-
54+
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface not found\\.$#"
55+
count: 1
56+
path: ../Classes/Backend/Preview/GridRenderer.php
57+
58+
-
59+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryData not found\\.$#"
60+
count: 1
61+
path: ../Classes/Backend/Preview/GridRenderer.php
62+
63+
-
64+
message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#"
65+
count: 1
66+
path: ../Classes/Domain/Factory/ContainerFactory.php
67+
68+
-
69+
message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#"
70+
count: 2
71+
path: ../Classes/Domain/Factory/PageView/Backend/ContentStorage.php

Build/phpstan-baseline-12.neon

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,28 @@ parameters:
3939
-
4040
message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 5 parameters, 2 required\\.$#"
4141
count: 1
42-
path: ../Tests/Functional/Integrity/IntegrityTest.php
42+
path: ../Tests/Functional/Integrity/IntegrityTest.php
43+
-
44+
message: "#^Call to method create\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface\\.$#"
45+
count: 1
46+
path: ../Classes/Backend/Preview/GridRenderer.php
47+
48+
-
49+
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface not found\\.$#"
50+
count: 1
51+
path: ../Classes/Backend/Preview/GridRenderer.php
52+
53+
-
54+
message: "#^Instantiated class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryData not found\\.$#"
55+
count: 1
56+
path: ../Classes/Backend/Preview/GridRenderer.php
57+
58+
-
59+
message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#"
60+
count: 1
61+
path: ../Classes/Domain/Factory/ContainerFactory.php
62+
63+
-
64+
message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:tryFrom\\(\\)\\.$#"
65+
count: 2
66+
path: ../Classes/Domain/Factory/PageView/Backend/ContentStorage.php

Build/phpstan-baseline-14.neon

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
parameters:
2+
ignoreErrors:
3+
4+
-
5+
message: "#^Constant LF not found\\.$#"
6+
count: 4
7+
path: ../Classes/Tca/Registry.php
8+
9+
-
10+
message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 679$#"
11+
count: 1
12+
path: ../Tests/Acceptance/Support/BackendTester.php
13+
14+
-
15+
message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \\* \", expected type at offset 743$#"
16+
count: 1
17+
path: ../Tests/Acceptance/Support/BackendTester.php
18+
19+
-
20+
message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ConfigurationException is not subtype of Throwable$#"
21+
count: 1
22+
path: ../Tests/Acceptance/Support/BackendTester.php
23+
24+
-
25+
message: "#^PHPDoc tag @throws with type B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\_generated\\\\ModuleException is not subtype of Throwable$#"
26+
count: 1
27+
path: ../Tests/Acceptance/Support/BackendTester.php
28+
29+
-
30+
message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#"
31+
count: 1
32+
path: ../Tests/Acceptance/Support/PageTree.php
33+
34+
-
35+
message: "#^Constant ORIGINAL_ROOT not found\\.$#"
36+
count: 1
37+
path: ../Tests/Functional/Datahandler/AbstractDatahandler.php
38+
39+
-
40+
message: "#^Class TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext constructor invoked with 2 parameters, 5 required\\.$#"
41+
count: 1
42+
path: ../Tests/Functional/Integrity/IntegrityTest.php
43+
-
44+
message: "#^Call to method assign\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#"
45+
count: 8
46+
path: ../Classes/Backend/Preview/GridRenderer.php
47+
48+
-
49+
message: "#^Call to method render\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#"
50+
count: 1
51+
path: ../Classes/Backend/Preview/GridRenderer.php
52+
53+
-
54+
message: "#^Call to method setLayoutRootPaths\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#"
55+
count: 1
56+
path: ../Classes/Backend/Preview/GridRenderer.php
57+
58+
-
59+
message: "#^Call to method setPartialRootPaths\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#"
60+
count: 1
61+
path: ../Classes/Backend/Preview/GridRenderer.php
62+
63+
-
64+
message: "#^Call to method setTemplatePathAndFilename\\(\\) on an unknown class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView\\.$#"
65+
count: 1
66+
path: ../Classes/Backend/Preview/GridRenderer.php
67+
68+
-
69+
message: "#^Class TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView not found\\.$#"
70+
count: 1
71+
path: ../Classes/Backend/Preview/GridRenderer.php
72+
73+
-
74+
message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:cast\\(\\)\\.$#"
75+
count: 1
76+
path: ../Classes/Domain/Factory/ContainerFactory.php
77+
78+
-
79+
message: "#^Call to an undefined static method TYPO3\\\\CMS\\\\Core\\\\Versioning\\\\VersionState\\:\\:cast\\(\\)\\.$#"
80+
count: 2
81+
path: ../Classes/Domain/Factory/PageView/Backend/ContentStorage.php

Build/phpstan11-7.4.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ parameters:
1616
- %currentWorkingDirectory%/Classes/Listener/RecordSummaryForLocalization.php
1717
- %currentWorkingDirectory%/Classes/Listener/PageTsConfig.php
1818
- %currentWorkingDirectory%/Classes/Listener/PageContentPreviewRendering.php
19+
- %currentWorkingDirectory%/Classes/Events/BeforeContainerPreviewIsRenderedEvent.php
1920

Build/phpstan11.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ parameters:
1616
- %currentWorkingDirectory%/Classes/Listener/RecordSummaryForLocalization.php
1717
- %currentWorkingDirectory%/Classes/Listener/PageTsConfig.php
1818
- %currentWorkingDirectory%/Classes/Listener/PageContentPreviewRendering.php
19+
- %currentWorkingDirectory%/Classes/Events/BeforeContainerPreviewIsRenderedEvent.php
1920

Build/phpstan14.neon

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
includes:
2+
- phpstan-baseline-14.neon
3+
4+
parameters:
5+
level: 5
6+
7+
paths:
8+
- %currentWorkingDirectory%/Classes
9+
- %currentWorkingDirectory%/Tests
10+
11+
excludePaths:
12+
- %currentWorkingDirectory%/Classes/Hooks/UsedRecords.php
13+
- %currentWorkingDirectory%/Tests/Functional/Hooks/UsedRecordsTest.php
14+
- %currentWorkingDirectory%/Tests/Unit/Hooks/UsedRecordsTest.php
15+
- %currentWorkingDirectory%/Classes/Hooks/WizardItems.php
16+
- %currentWorkingDirectory%/Classes/Listener/LegacyPageTsConfig.php
17+
- %currentWorkingDirectory%/Classes/ContentDefender
18+
- %currentWorkingDirectory%/Classes/Events/BeforeContainerPreviewIsRenderedEventV12.php
19+
- %currentWorkingDirectory%/Tests/Functional/Integrity/IntegrityTest.php
20+

Classes/Backend/Preview/GridRenderer.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,20 @@
1818
use B13\Container\Domain\Factory\Exception;
1919
use B13\Container\Domain\Factory\PageView\Backend\ContainerFactory;
2020
use B13\Container\Events\BeforeContainerPreviewIsRenderedEvent;
21+
use B13\Container\Events\BeforeContainerPreviewIsRenderedEventV12;
2122
use B13\Container\Tca\Registry;
2223
use Psr\EventDispatcher\EventDispatcherInterface;
2324
use TYPO3\CMS\Backend\Utility\BackendUtility;
2425
use TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid;
25-
use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem;
2626
use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridRow;
2727
use TYPO3\CMS\Backend\View\PageLayoutContext;
2828
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
2929
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
30+
use TYPO3\CMS\Core\Information\Typo3Version;
3031
use TYPO3\CMS\Core\Localization\LanguageService;
3132
use TYPO3\CMS\Core\Utility\GeneralUtility;
33+
use TYPO3\CMS\Core\View\ViewFactoryData;
34+
use TYPO3\CMS\Core\View\ViewFactoryInterface;
3235
use TYPO3\CMS\Fluid\View\StandaloneView;
3336

3437
class GridRenderer
@@ -86,10 +89,20 @@ public function renderGrid(array $record, PageLayoutContext $context): string
8689
$gridTemplate = $this->tcaRegistry->getGridTemplate($record['CType']);
8790
$partialRootPaths = $this->tcaRegistry->getGridPartialPaths($record['CType']);
8891
$layoutRootPaths = $this->tcaRegistry->getGridLayoutPaths($record['CType']);
89-
$view = GeneralUtility::makeInstance(StandaloneView::class);
90-
$view->setPartialRootPaths($partialRootPaths);
91-
$view->setLayoutRootPaths($layoutRootPaths);
92-
$view->setTemplatePathAndFilename($gridTemplate);
92+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 13) {
93+
$view = GeneralUtility::makeInstance(StandaloneView::class);
94+
$view->setPartialRootPaths($partialRootPaths);
95+
$view->setLayoutRootPaths($layoutRootPaths);
96+
$view->setTemplatePathAndFilename($gridTemplate);
97+
} else {
98+
$viewFactory = GeneralUtility::makeInstance(ViewFactoryInterface::class);
99+
$view = $viewFactory->create(new ViewFactoryData(
100+
null,
101+
$partialRootPaths,
102+
$layoutRootPaths,
103+
$gridTemplate
104+
));
105+
}
93106

94107
$view->assign('hideRestrictedColumns', (bool)(BackendUtility::getPagesTSconfig($context->getPageId())['mod.']['web_layout.']['hideRestrictedCols'] ?? false));
95108
$view->assign('newContentTitle', $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newContentElement'));
@@ -101,7 +114,11 @@ public function renderGrid(array $record, PageLayoutContext $context): string
101114
$view->assign('containerRecord', $record);
102115
$view->assign('context', $context);
103116
$parentGridColumnItem = $this->runtimeCache->get('tx_container_current_gridColumItem');
104-
$beforeContainerPreviewIsRendered = new BeforeContainerPreviewIsRenderedEvent($container, $view, $grid, $parentGridColumnItem);
117+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 13) {
118+
$beforeContainerPreviewIsRendered = new BeforeContainerPreviewIsRenderedEventV12($container, $view, $grid, $parentGridColumnItem);
119+
} else {
120+
$beforeContainerPreviewIsRendered = new BeforeContainerPreviewIsRenderedEvent($container, $view, $grid, $parentGridColumnItem);
121+
}
105122
$this->eventDispatcher->dispatch($beforeContainerPreviewIsRendered);
106123
$rendered = $view->render();
107124
return $rendered;

Classes/Domain/Factory/ContainerFactory.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use B13\Container\Tca\Registry;
1717
use TYPO3\CMS\Backend\Utility\BackendUtility;
1818
use TYPO3\CMS\Core\Context\Context;
19+
use TYPO3\CMS\Core\Information\Typo3Version;
1920
use TYPO3\CMS\Core\SingletonInterface;
2021
use TYPO3\CMS\Core\Utility\GeneralUtility;
2122
use TYPO3\CMS\Core\Versioning\VersionState;
@@ -107,8 +108,14 @@ protected function workspaceOverlay(array $records): array
107108
$filtered = [];
108109
foreach ($records as $row) {
109110
BackendUtility::workspaceOL('tt_content', $row, $this->workspaceId, true);
110-
if ($row && !VersionState::cast($row['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER)) {
111-
$filtered[] = $row;
111+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 12) {
112+
if ($row && VersionState::tryFrom($row['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) {
113+
$filtered[] = $row;
114+
}
115+
} else {
116+
if ($row && !VersionState::cast($row['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER)) {
117+
$filtered[] = $row;
118+
}
112119
}
113120
}
114121
return $filtered;

0 commit comments

Comments
 (0)