|
15 | 15 | use B13\Container\Integrity\Error\WrongPidError; |
16 | 16 | use B13\Container\Integrity\Integrity; |
17 | 17 | use B13\Container\Integrity\IntegrityFix; |
| 18 | +use TYPO3\CMS\Backend\Context\PageContext; |
| 19 | +use TYPO3\CMS\Backend\Domain\Model\Language\PageLanguageInformation; |
18 | 20 | use TYPO3\CMS\Backend\View\BackendLayout\BackendLayout; |
19 | 21 | use TYPO3\CMS\Backend\View\BackendLayout\ContentFetcher; |
20 | 22 | use TYPO3\CMS\Backend\View\Drawing\DrawingConfiguration; |
|
25 | 27 | use TYPO3\CMS\Core\Information\Typo3Version; |
26 | 28 | use TYPO3\CMS\Core\Localization\LanguageServiceFactory; |
27 | 29 | use TYPO3\CMS\Core\Site\Entity\Site; |
| 30 | +use TYPO3\CMS\Core\Type\Bitmask\Permission; |
28 | 31 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
29 | 32 | use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; |
30 | 33 |
|
@@ -86,14 +89,43 @@ public function wrongPidErrorElementsAreShownAsUnusedElements(): void |
86 | 89 | ->fetchAssociative(); |
87 | 90 | if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 12) { |
88 | 91 | $pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout); |
| 92 | + $contentFetcher = new ContentFetcher($pageLayoutContext); |
| 93 | + $unusedRecords = $contentFetcher->getUnusedRecords(); |
89 | 94 | } else { |
90 | 95 | $site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock(); |
91 | 96 | $drawingConfiguration = $this->getMockBuilder(DrawingConfiguration::class)->disableOriginalConstructor()->getMock(); |
92 | 97 | $serverRequest = $this->getMockBuilder(ServerRequest::class)->disableOriginalConstructor()->getMock(); |
93 | | - $pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout, $site, $drawingConfiguration, $serverRequest); |
| 98 | + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 14) { |
| 99 | + $pageLayoutContext = new PageLayoutContext($pageRecord, $backendLayout, $site, $drawingConfiguration, $serverRequest); |
| 100 | + $contentFetcher = new ContentFetcher($pageLayoutContext); |
| 101 | + $unusedRecords = $contentFetcher->getUnusedRecords(); |
| 102 | + } else { |
| 103 | + $pageLanguageInformation = new PageLanguageInformation( |
| 104 | + $pageRecord['uid'], |
| 105 | + [], |
| 106 | + [], |
| 107 | + [], |
| 108 | + [0], |
| 109 | + false, |
| 110 | + [] |
| 111 | + ); |
| 112 | + $pageContext = new PageContext( |
| 113 | + $pageRecord['uid'], |
| 114 | + $pageRecord, |
| 115 | + $site, |
| 116 | + [], |
| 117 | + [], |
| 118 | + [], |
| 119 | + $pageLanguageInformation, |
| 120 | + new Permission() |
| 121 | + ); |
| 122 | + $pageLayoutContext = new PageLayoutContext($pageContext, $backendLayout, $drawingConfiguration, $serverRequest); |
| 123 | + $container = $this->get('service_container'); |
| 124 | + $contentFetcher = $container->get(ContentFetcher::class); |
| 125 | + $unusedRecords = $contentFetcher->getUnusedRecords($pageLayoutContext); |
| 126 | + } |
94 | 127 | } |
95 | | - $contentFetcher = new ContentFetcher($pageLayoutContext); |
96 | | - $unusedRecords = $contentFetcher->getUnusedRecords(); |
| 128 | + |
97 | 129 | $unusedRecordsArr = []; |
98 | 130 | foreach ($unusedRecords as $unusedRecord) { |
99 | 131 | $unusedRecordsArr[] = $unusedRecord; |
|
0 commit comments