diff --git a/Tests/Integration/FrontendEnvironment/Fixtures/can_initialize_tsfe_for_page_with_different_fe_groups_settings.xml b/Tests/Integration/FrontendEnvironment/Fixtures/can_initialize_tsfe_for_page_with_different_fe_groups_settings.xml new file mode 100644 index 0000000000..03c15cc880 --- /dev/null +++ b/Tests/Integration/FrontendEnvironment/Fixtures/can_initialize_tsfe_for_page_with_different_fe_groups_settings.xml @@ -0,0 +1,23 @@ + + + + 2 + 0 + 1 + 1 + 1 + + + 3 + 0 + 1 + 1 + -2 + + + + 1 + 1 + dummy group + + diff --git a/Tests/Integration/FrontendEnvironment/TsfeTest.php b/Tests/Integration/FrontendEnvironment/TsfeTest.php index 1648899157..97dce55166 100644 --- a/Tests/Integration/FrontendEnvironment/TsfeTest.php +++ b/Tests/Integration/FrontendEnvironment/TsfeTest.php @@ -6,6 +6,7 @@ use ApacheSolrForTypo3\Solr\Tests\Integration\IntegrationTest; use RuntimeException; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; class TsfeTest extends IntegrationTest { @@ -53,4 +54,37 @@ public function initializeTsfeWithNoDefaultPageAndPageErrorHandlerDoNotThrowAnEr $tsfeManager = GeneralUtility::makeInstance(Tsfe::class); $tsfeManager->getTsfeByPageIdAndLanguageId(1); } + + /** + * @test + */ + public function canInitializeTsfeForPageWithDifferentFeGroupsSettings() + { + $this->writeDefaultSolrTestSiteConfiguration(); + $this->importDataSetFromFixture('can_initialize_tsfe_for_page_with_different_fe_groups_settings.xml'); + + $tsfeNotRestricted = GeneralUtility::makeInstance(Tsfe::class)->getTsfeByPageIdIgnoringLanguage(1); + self::assertInstanceOf( + TypoScriptFrontendController::class, + $tsfeNotRestricted, + 'The TSFE can not be initialized at all, nor for public page either for access restricted(fe_group) page. ' . + 'Most probably nothing will work.' + ); + + $tsfeRestrictedForExistingFeGroup = GeneralUtility::makeInstance(Tsfe::class)->getTsfeByPageIdIgnoringLanguage(2); + self::assertInstanceOf( + TypoScriptFrontendController::class, + $tsfeRestrictedForExistingFeGroup, + 'The TSFE can not be initialized for existing fe_group. ' . + 'This will lead to failures on editing the access restricted [sub]pages in BE.' + ); + + $tsfeForLoggedInUserOnly = GeneralUtility::makeInstance(Tsfe::class)->getTsfeByPageIdIgnoringLanguage(3); + self::assertInstanceOf( + TypoScriptFrontendController::class, + $tsfeForLoggedInUserOnly, + 'The TSFE can not be initialized for page with fe_group="-2". ' . + 'This will lead to failures on editing the [sub]pages in BE for pages with fe_group="-2".' + ); + } }