From fcfe3d5304fa196e565fa6e14a72e80d3fc9f014 Mon Sep 17 00:00:00 2001 From: Achim Fritz Date: Fri, 24 May 2024 16:19:54 +0200 Subject: [PATCH] !!! [TASK] change requirements * drop TYPO3 10 Support * add TYPO3 13 Support --- .github/workflows/ci.yml | 8 +-- Build/Scripts/runTests.sh | 6 -- Build/phpstan10.neon | 11 ---- Build/phpstan11.neon | 12 ++++ Build/phpstan12.neon | 6 +- Build/phpstan13.neon | 27 ++++++++ Build/phpunit/UnitTestsBootstrap.php | 31 ++-------- Build/testing-docker/docker-compose.yml | 31 ++-------- Classes/CacheHelper.php | 62 ++++++++++++++++++- Classes/Compiler/LanguageMenuCompiler.php | 12 +++- Classes/Domain/Repository/MenuRepository.php | 5 +- .../DataProcessing/BreadcrumbsMenuTest.php | 4 +- ...aProcessingTest.php => DataProcessing.php} | 2 +- .../DataProcessing/ListMenuProcessorTest.php | 6 +- .../DataProcessing/TreeMenuProcessorTest.php | 6 +- .../Frontend/AbstractFrontendTest.php | 33 ---------- .../BreadcrumbMenuContentObjectTest.php | 11 +++- .../Frontend/BreadcrumbMenuFluidTest.php | 11 +++- .../LanguageMenuContentObjectTest.php | 11 +++- .../Frontend/LanguageMenuFluidTest.php | 11 +++- .../Frontend/ListMenuContentObjectTest.php | 11 +++- .../Functional/Frontend/ListMenuFluidTest.php | 11 +++- .../Frontend/TreeMenuContentObjectTest.php | 11 +++- .../Functional/Frontend/TreeMenuFluidTest.php | 15 +++-- Tests/Functional/Hooks/DataHandlerTest.php | 8 +-- .../Domain/Repository/MenuRepositoryTest.php | 54 +++++++++++----- composer.json | 20 +++--- 27 files changed, 256 insertions(+), 180 deletions(-) delete mode 100644 Build/phpstan10.neon create mode 100644 Build/phpstan13.neon rename Tests/Functional/DataProcessing/{DataProcessingTest.php => DataProcessing.php} (98%) delete mode 100644 Tests/Functional/Frontend/AbstractFrontendTest.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29a3b47..a8e46c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,18 +16,14 @@ jobs: php: [ '7.4', '8.0', '8.1' ] TYPO3: [ '11' ] include: - - TYPO3: '10' - php: '7.4' - TYPO3: '12' php: '8.1' + - TYPO3: '13' + php: '8.3' steps: - name: Checkout uses: actions/checkout@v2 - - name: Patch 10 - if: matrix.TYPO3 == '10' - run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s patchV10 - - name: Install testing system run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s composerInstall diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 3b7d456..2d7e106 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -241,12 +241,6 @@ case ${TEST_SUITE} in SUITE_EXIT_CODE=$? docker-compose down ;; - patchV10) - setUpDockerComposeDotEnv - docker-compose run patchV10 - SUITE_EXIT_CODE=$? - docker-compose down - ;; functional) setUpDockerComposeDotEnv case ${DBMS} in diff --git a/Build/phpstan10.neon b/Build/phpstan10.neon deleted file mode 100644 index c010b87..0000000 --- a/Build/phpstan10.neon +++ /dev/null @@ -1,11 +0,0 @@ -parameters: - level: 5 - - paths: - - %currentWorkingDirectory%/Classes - - %currentWorkingDirectory%/Tests - - ignoreErrors: - - - message: '#Property TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController::\$id \(string\) does not accept int#' - path: %currentWorkingDirectory%/Tests/Functional/Compiler/LanguageMenuCompilerTest.php diff --git a/Build/phpstan11.neon b/Build/phpstan11.neon index 885e254..8bf0294 100644 --- a/Build/phpstan11.neon +++ b/Build/phpstan11.neon @@ -4,3 +4,15 @@ parameters: paths: - %currentWorkingDirectory%/Classes - %currentWorkingDirectory%/Tests + excludePaths: + - %currentWorkingDirectory%/Tests/Unit/Domain/Repository/MenuRepositoryTest.php + ignoreErrors: + - + message: '#Cannot call method getLanguageCode\(\) on string.#' + path: %currentWorkingDirectory%/Classes/Compiler/LanguageMenuCompiler.php + - + message: '#Class TYPO3\\CMS\\Frontend\\Cache\\CacheLifetimeCalculator not found.#' + path: %currentWorkingDirectory%/Classes/CacheHelper.php + - + message: '#.*unknown class TYPO3\\CMS\\Core\\TypoScript\\FrontendTypoScript.#' + path: %currentWorkingDirectory%/Classes/CacheHelper.php diff --git a/Build/phpstan12.neon b/Build/phpstan12.neon index aa46a85..e8f1027 100644 --- a/Build/phpstan12.neon +++ b/Build/phpstan12.neon @@ -4,7 +4,8 @@ parameters: paths: - %currentWorkingDirectory%/Classes - %currentWorkingDirectory%/Tests - + excludePaths: + - %currentWorkingDirectory%/Tests/Unit/Domain/Repository/MenuRepositoryTest.php ignoreErrors: - message: '#Call to an undefined static method TYPO3\\CMS\\Frontend\\ContentObject\\AbstractContentObject::__construct\(\).#' @@ -12,3 +13,6 @@ parameters: - message: '#Property TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController::\$id \(int\) does not accept string.#' path: %currentWorkingDirectory%/Tests/Functional/Compiler/LanguageMenuCompilerTest.php + - + message: '#Call to an undefined method TYPO3\\CMS\\Core\\TypoScript\\FrontendTypoScript::getConfigArray\(\).#' + path: %currentWorkingDirectory%/Classes/CacheHelper.php diff --git a/Build/phpstan13.neon b/Build/phpstan13.neon new file mode 100644 index 0000000..e396ce1 --- /dev/null +++ b/Build/phpstan13.neon @@ -0,0 +1,27 @@ +parameters: + level: 5 + + paths: + - %currentWorkingDirectory%/Classes + - %currentWorkingDirectory%/Tests + excludePaths: + - %currentWorkingDirectory%/Tests/Unit/Domain/Repository/MenuRepositoryTest.php + ignoreErrors: + - + message: '#Call to an undefined method TYPO3\\CMS\\Core\\Site\\Entity\\SiteLanguage::getTwoLetterIsoCode\(\).#' + path: %currentWorkingDirectory%/Classes/Compiler/LanguageMenuCompiler.php + - + message: '#Access to undefined constant TYPO3\\CMS\\Core\\Domain\\Repository\\PageRepository::DOKTYPE_RECYCLER.#' + path: %currentWorkingDirectory%/Classes/Domain/Repository/MenuRepository.php + - + message: '#Access to undefined constant TYPO3\\CMS\\Core\\Domain\\Repository\\PageRepository::DOKTYPE_RECYCLER.#' + path: %currentWorkingDirectory%/Tests/Unit/Domain/Repository/MenuRepositoryTest.php + - + message: '#.*get_cache_timeout\(\).*#' + path: %currentWorkingDirectory%/Classes/CacheHelper.php + - + message: '#Call to an undefined static method TYPO3\\CMS\\Frontend\\ContentObject\\AbstractContentObject::__construct\(\).#' + path: %currentWorkingDirectory%/Classes/ContentObject/* + - + message: '#Property TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController::\$id \(int\) does not accept string.#' + path: %currentWorkingDirectory%/Tests/Functional/Compiler/LanguageMenuCompilerTest.php diff --git a/Build/phpunit/UnitTestsBootstrap.php b/Build/phpunit/UnitTestsBootstrap.php index b12ccf0..a91159e 100644 --- a/Build/phpunit/UnitTestsBootstrap.php +++ b/Build/phpunit/UnitTestsBootstrap.php @@ -12,25 +12,9 @@ * The TYPO3 project - inspiring people to share! */ -use TYPO3\CMS\Core\Information\Typo3Version; - call_user_func(function () { $testbase = new \TYPO3\TestingFramework\Core\Testbase(); - // These if's are for core testing (package typo3/cms) only. cms-composer-installer does - // not create the autoload-include.php file that sets these env vars and sets composer - // mode to true. testing-framework can not be used without composer anyway, so it is safe - // to do this here. This way it does not matter if 'bin/phpunit' or 'vendor/phpunit/phpunit/phpunit' - // is called to run the tests since the 'relative to entry script' path calculation within - // SystemEnvironmentBuilder is not used. However, the binary must be called from the document - // root since getWebRoot() uses 'getcwd()'. - if (!getenv('TYPO3_PATH_ROOT')) { - putenv('TYPO3_PATH_ROOT=' . rtrim($testbase->getWebRoot(), '/')); - } - if (!getenv('TYPO3_PATH_WEB')) { - putenv('TYPO3_PATH_WEB=' . rtrim($testbase->getWebRoot(), '/')); - } - $testbase->defineSitePath(); $requestType = \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE | \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_CLI; @@ -54,17 +38,10 @@ new \TYPO3\CMS\Core\Cache\Backend\NullBackend('production', []) ); // Set all packages to active - if (version_compare((new Typo3Version())->getVersion(), '11.3.0', '>')) { - $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager( - \TYPO3\CMS\Core\Package\UnitTestPackageManager::class, - \TYPO3\CMS\Core\Core\Bootstrap::createPackageCache($cache) - ); - } else { - $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager( - \TYPO3\CMS\Core\Package\UnitTestPackageManager::class, - $cache - ); - } + $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager( + \TYPO3\CMS\Core\Package\UnitTestPackageManager::class, + \TYPO3\CMS\Core\Core\Bootstrap::createPackageCache($cache) + ); \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Package\PackageManager::class, $packageManager); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::setPackageManager($packageManager); diff --git a/Build/testing-docker/docker-compose.yml b/Build/testing-docker/docker-compose.yml index 24d78f5..61d3325 100644 --- a/Build/testing-docker/docker-compose.yml +++ b/Build/testing-docker/docker-compose.yml @@ -83,38 +83,17 @@ services: fi php -v | grep '^PHP'; if [ ${TYPO3} -eq 11 ]; then - composer install --no-progress --no-interaction + composer require typo3/cms-install:^11.5 typo3/cms-fluid-styled-content:^11.5 --dev -W --no-progress --no-interaction composer prepare-tests - elif [ ${TYPO3} -eq 10 ]; then - composer require friendsofphp/php-cs-fixer:^3.4 typo3/cms-install:^10.4 typo3/cms-fluid-styled-content:^10.4 typo3/testing-framework:^6 --dev -W --no-progress --no-interaction - if [ "${PHP_VERSION}" == "7.4" ]; then - composer require friendsofphp/php-cs-fixer:~3.9.0 --dev --no-progress --no-interaction - fi - composer prepare-tests-10 && composer prepare-tests - else + elif [ ${TYPO3} -eq 12 ]; then composer require typo3/cms-install:^12.4 typo3/cms-fluid-styled-content:^12.4 --dev -W --no-progress --no-interaction composer prepare-tests + else + composer install --no-progress --no-interaction + composer prepare-tests fi " - patchV10: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest - user: ${HOST_UID} - volumes: - - ${ROOT_DIR}:${ROOT_DIR} - - ${HOST_HOME}:${HOST_HOME} - - /etc/passwd:/etc/passwd:ro - - /etc/group:/etc/group:ro - working_dir: ${ROOT_DIR} - command: > - /bin/sh -c " - find Tests -name \\*.php -print0 | xargs -0 sed -i 's/protected array \(.*\)testExtensionsToLoad = \[/protected \1testExtensionsToLoad = [/g'; - find Tests -name \\*.php -print0 | xargs -0 sed -i 's/protected bool \(.*\)resetSingletonInstances = /protected \1resetSingletonInstances = /g'; - find Tests -name \\*.php -print0 | xargs -0 sed -i 's/protected array \(.*\)coreExtensionsToLoad = \[/protected \1coreExtensionsToLoad = [/g'; - find Tests -name \\*.php -print0 | xargs -0 sed -i 's/protected array \(.*\)pathsToLinkInTestInstance = \[/protected \1pathsToLinkInTestInstance = [/g'; - find Tests -name \\*.php -print0 | xargs -0 sed -i 's/protected array \(.*\)configurationToUseInTestInstance = \[/protected \1configurationToUseInTestInstance = [/g'; - " - composer_validate: image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest user: ${HOST_UID} diff --git a/Classes/CacheHelper.php b/Classes/CacheHelper.php index a196c66..4fedd6e 100644 --- a/Classes/CacheHelper.php +++ b/Classes/CacheHelper.php @@ -11,10 +11,15 @@ * of the License, or any later version. */ +use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\SingletonInterface; +use TYPO3\CMS\Core\TypoScript\FrontendTypoScript; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Frontend\Cache\CacheLifetimeCalculator; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; /** @@ -27,9 +32,11 @@ class CacheHelper implements SingletonInterface { protected FrontendInterface $cache; protected bool $disableCaching = false; + protected Context $context; public function __construct(FrontendInterface $cache, Context $context) { + $this->context = $context; $this->cache = $cache; try { $this->disableCaching = $context->getPropertyFromAspect('workspace', 'id', 0) > 0; @@ -63,7 +70,8 @@ public function get(string $cacheIdentifier, callable $loader): array // Calculate tags + lifetime $tags = $this->buildTagsAndAddThemToPageCache($pages); - $maximumLifeTime = $this->getMaxLifetimeOfPages($pages, $this->getFrontendController()->get_cache_timeout()); + $defaultMaxLifeTime = $this->getDefaultMaxLifeTime(); + $maximumLifeTime = $this->getMaxLifetimeOfPages($pages, $defaultMaxLifeTime); $this->cache->set($cacheIdentifier, $pages, $tags, $maximumLifeTime); return $pages; } @@ -108,15 +116,58 @@ protected function getAllPageIdsFromItems(array $pages): array return $pageIds; } + protected function getDefaultMaxLifeTime(): int + { + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { + $maxLifetime = (int)$this->getFrontendController()->get_cache_timeout(); + } else { + $request = $this->getServerRequest(); + $pageInformation = $request->getAttribute('frontend.page.information'); + /** @var ?FrontendTypoScript $typoScript */ + $typoScript = $request->getAttribute('frontend.typoscript'); + if ($typoScript === null || $pageInformation === null) { + return 0; + } + $typoScriptConfigArray = $typoScript->getConfigArray(); + $maxLifetime = GeneralUtility::makeInstance(CacheLifetimeCalculator::class) + ->calculateLifetimeForPage( + $pageInformation->getId(), + $pageInformation->getPageRecord(), + $typoScriptConfigArray, + 0, + $this->context + ); + } + return $maxLifetime; + } + /** * pages.cache_timeout is not used here, as this is supposed to be relevant for content of a page, not the * metadata. */ - protected function getMaxLifetimeOfPages(array $pages, int $maxLifetime = null): ?int + protected function getMaxLifetimeOfPages(array $pages, int $maxLifetime): int { foreach ($pages as $page) { if (!empty($page['endtime'])) { - $maxLifetimeOfPage = $page['endtime'] - $GLOBALS['EXEC_TIME']; + $maxLifetimeOfPage = (int)$page['endtime'] - $GLOBALS['EXEC_TIME']; + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() === 13) { + $request = $this->getServerRequest(); + /** @var ?FrontendTypoScript $typoScript */ + $typoScript = $request->getAttribute('frontend.typoscript'); + if ($typoScript === null) { + $typoScriptConfigArray = []; + } else { + $typoScriptConfigArray = $typoScript->getConfigArray(); + } + $maxLifetimeOfPage = GeneralUtility::makeInstance(CacheLifetimeCalculator::class) + ->calculateLifetimeForPage( + $page['uid'], + $page, + $typoScriptConfigArray, + 0, + $this->context + ); + } if ($maxLifetimeOfPage < $maxLifetime) { $maxLifetime = $maxLifetimeOfPage; } @@ -128,6 +179,11 @@ protected function getMaxLifetimeOfPages(array $pages, int $maxLifetime = null): return $maxLifetime; } + protected function getServerRequest(): ServerRequestInterface + { + return $GLOBALS['TYPO3_REQUEST']; + } + protected function getFrontendController(): TypoScriptFrontendController { return $GLOBALS['TSFE']; diff --git a/Classes/Compiler/LanguageMenuCompiler.php b/Classes/Compiler/LanguageMenuCompiler.php index efbe5a7..c1a0c5e 100644 --- a/Classes/Compiler/LanguageMenuCompiler.php +++ b/Classes/Compiler/LanguageMenuCompiler.php @@ -13,6 +13,8 @@ use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\LanguageAspectFactory; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; @@ -38,7 +40,7 @@ public function compile(ContentObjectRenderer $contentObjectRenderer, array $con $context = clone GeneralUtility::makeInstance(Context::class); $pages = []; foreach ($site->getLanguages() as $language) { - if (in_array($language->getTwoLetterIsoCode(), $excludedLanguages, true)) { + if (in_array($this->getLanguageCode($language), $excludedLanguages, true)) { continue; } if (in_array((string)$language->getLanguageId(), $excludedLanguages, true)) { @@ -62,4 +64,12 @@ public function compile(ContentObjectRenderer $contentObjectRenderer, array $con return $pages; }); } + + protected function getLanguageCode(SiteLanguage $language): string + { + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() === 11) { + return $language->getTwoLetterIsoCode(); + } + return $language->getLocale()->getLanguageCode(); + } } diff --git a/Classes/Domain/Repository/MenuRepository.php b/Classes/Domain/Repository/MenuRepository.php index 86425c4..b9579a3 100644 --- a/Classes/Domain/Repository/MenuRepository.php +++ b/Classes/Domain/Repository/MenuRepository.php @@ -16,6 +16,7 @@ use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\LanguageAspect; use TYPO3\CMS\Core\Domain\Repository\PageRepository; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -31,7 +32,6 @@ class MenuRepository // Never show or query them. protected $excludedDoktypes = [ PageRepository::DOKTYPE_BE_USER_SECTION, - PageRepository::DOKTYPE_RECYCLER, PageRepository::DOKTYPE_SYSFOLDER, ]; @@ -40,6 +40,9 @@ public function __construct(Context $context, PageRepository $pageRepository, Ev $this->context = $context; $this->pageRepository = $pageRepository; $this->eventDispatcher = $eventDispatcher; + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { + $this->excludedDoktypes[] = PageRepository::DOKTYPE_RECYCLER; + } } public function getBreadcrumbsMenu(array $originalRootLine, array $configuration): array diff --git a/Tests/Functional/DataProcessing/BreadcrumbsMenuTest.php b/Tests/Functional/DataProcessing/BreadcrumbsMenuTest.php index e5e3f17..f62373a 100644 --- a/Tests/Functional/DataProcessing/BreadcrumbsMenuTest.php +++ b/Tests/Functional/DataProcessing/BreadcrumbsMenuTest.php @@ -16,12 +16,12 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; -class BreadcrumbsMenuTest extends DataProcessingTest +class BreadcrumbsMenuTest extends DataProcessing { /** * @return array */ - public function setupDataProvider() + public static function setupDataProvider() { return [ [ diff --git a/Tests/Functional/DataProcessing/DataProcessingTest.php b/Tests/Functional/DataProcessing/DataProcessing.php similarity index 98% rename from Tests/Functional/DataProcessing/DataProcessingTest.php rename to Tests/Functional/DataProcessing/DataProcessing.php index 8472fae..44934ed 100644 --- a/Tests/Functional/DataProcessing/DataProcessingTest.php +++ b/Tests/Functional/DataProcessing/DataProcessing.php @@ -22,7 +22,7 @@ use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -abstract class DataProcessingTest extends FunctionalTestCase +abstract class DataProcessing extends FunctionalTestCase { protected array $testExtensionsToLoad = ['typo3conf/ext/menus']; diff --git a/Tests/Functional/DataProcessing/ListMenuProcessorTest.php b/Tests/Functional/DataProcessing/ListMenuProcessorTest.php index 7d7dfe9..5459d22 100644 --- a/Tests/Functional/DataProcessing/ListMenuProcessorTest.php +++ b/Tests/Functional/DataProcessing/ListMenuProcessorTest.php @@ -19,12 +19,12 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; -class ListMenuProcessorTest extends DataProcessingTest +class ListMenuProcessorTest extends DataProcessing { /** * @return array */ - public function setupDataProvider() + public static function setupDataProvider() { return [ [ @@ -335,7 +335,7 @@ public function processTest(array $tsfe, array $configuration, array $expected) /** * @return array */ - public function cacheDataProvider() + public static function cacheDataProvider() { return [ [ diff --git a/Tests/Functional/DataProcessing/TreeMenuProcessorTest.php b/Tests/Functional/DataProcessing/TreeMenuProcessorTest.php index 7450a9c..62d1b4f 100644 --- a/Tests/Functional/DataProcessing/TreeMenuProcessorTest.php +++ b/Tests/Functional/DataProcessing/TreeMenuProcessorTest.php @@ -19,12 +19,12 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; -class TreeMenuProcessorTest extends DataProcessingTest +class TreeMenuProcessorTest extends DataProcessing { /** * @return array */ - public function setupDataProvider() + public static function setupDataProvider() { return [ [ @@ -417,7 +417,7 @@ public function processTest(array $tsfe, array $configuration, array $expected): /** * @return array */ - public function cacheDataProvider() + public static function cacheDataProvider() { return [ // entry point 2 diff --git a/Tests/Functional/Frontend/AbstractFrontendTest.php b/Tests/Functional/Frontend/AbstractFrontendTest.php deleted file mode 100644 index 25357ca..0000000 --- a/Tests/Functional/Frontend/AbstractFrontendTest.php +++ /dev/null @@ -1,33 +0,0 @@ - 'typo3conf/sites']; - - protected function executeFrontendRequestWrapper(InternalRequest $request, InternalRequestContext $context = null, bool $followRedirects = false): ResponseInterface - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 11) { - return $this->executeFrontendRequest($request, $context, $followRedirects); - } - return $this->executeFrontendSubRequest($request, $context, $followRedirects); - } -} diff --git a/Tests/Functional/Frontend/BreadcrumbMenuContentObjectTest.php b/Tests/Functional/Frontend/BreadcrumbMenuContentObjectTest.php index 2b2b628..72f153f 100644 --- a/Tests/Functional/Frontend/BreadcrumbMenuContentObjectTest.php +++ b/Tests/Functional/Frontend/BreadcrumbMenuContentObjectTest.php @@ -11,9 +11,14 @@ */ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class BreadcrumbMenuContentObjectTest extends AbstractFrontendTest +class BreadcrumbMenuContentObjectTest extends FunctionalTestCase { + protected array $testExtensionsToLoad = ['typo3conf/ext/menus']; + protected array $coreExtensionsToLoad = ['core', 'frontend']; + protected array $pathsToLinkInTestInstance = ['typo3conf/ext/menus/Build/sites' => 'typo3conf/sites']; + /** * @test */ @@ -21,7 +26,7 @@ public function menuOnRootPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/breadcrumb_menu_content_object_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $expected = 'root'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); @@ -34,7 +39,7 @@ public function menuOnSubpage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/breadcrumb_menu_content_object_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/page-1')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/page-1')); $expected = 'rootpage-1'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); diff --git a/Tests/Functional/Frontend/BreadcrumbMenuFluidTest.php b/Tests/Functional/Frontend/BreadcrumbMenuFluidTest.php index 681665d..a028ab9 100644 --- a/Tests/Functional/Frontend/BreadcrumbMenuFluidTest.php +++ b/Tests/Functional/Frontend/BreadcrumbMenuFluidTest.php @@ -11,9 +11,14 @@ */ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class BreadcrumbMenuFluidTest extends AbstractFrontendTest +class BreadcrumbMenuFluidTest extends FunctionalTestCase { + protected array $testExtensionsToLoad = ['typo3conf/ext/menus']; + protected array $coreExtensionsToLoad = ['core', 'frontend']; + protected array $pathsToLinkInTestInstance = ['typo3conf/ext/menus/Build/sites' => 'typo3conf/sites']; + /** * @test */ @@ -21,7 +26,7 @@ public function menuOnRootPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/breadcrumb_menu_fluid_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $expected = 'root'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); @@ -34,7 +39,7 @@ public function menuOnSubpage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/breadcrumb_menu_fluid_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/page-1')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/page-1')); $expected = 'rootpage-1'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); diff --git a/Tests/Functional/Frontend/LanguageMenuContentObjectTest.php b/Tests/Functional/Frontend/LanguageMenuContentObjectTest.php index 3241972..23fac1c 100644 --- a/Tests/Functional/Frontend/LanguageMenuContentObjectTest.php +++ b/Tests/Functional/Frontend/LanguageMenuContentObjectTest.php @@ -11,9 +11,14 @@ */ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class LanguageMenuContentObjectTest extends AbstractFrontendTest +class LanguageMenuContentObjectTest extends FunctionalTestCase { + protected array $testExtensionsToLoad = ['typo3conf/ext/menus']; + protected array $coreExtensionsToLoad = ['core', 'frontend']; + protected array $pathsToLinkInTestInstance = ['typo3conf/ext/menus/Build/sites' => 'typo3conf/sites']; + /** * @test */ @@ -22,7 +27,7 @@ public function menuOnRootPage(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/translated_pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/language_menu_content_object_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $expected = 'englishgerman'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); @@ -36,7 +41,7 @@ public function menuOnSubpage(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/translated_pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/language_menu_content_object_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/de/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/de/')); $expected = 'englishgerman'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); diff --git a/Tests/Functional/Frontend/LanguageMenuFluidTest.php b/Tests/Functional/Frontend/LanguageMenuFluidTest.php index 994ba58..181a0f7 100644 --- a/Tests/Functional/Frontend/LanguageMenuFluidTest.php +++ b/Tests/Functional/Frontend/LanguageMenuFluidTest.php @@ -11,9 +11,14 @@ */ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class LanguageMenuFluidTest extends AbstractFrontendTest +class LanguageMenuFluidTest extends FunctionalTestCase { + protected array $testExtensionsToLoad = ['typo3conf/ext/menus']; + protected array $coreExtensionsToLoad = ['core', 'frontend']; + protected array $pathsToLinkInTestInstance = ['typo3conf/ext/menus/Build/sites' => 'typo3conf/sites']; + /** * @test */ @@ -22,7 +27,7 @@ public function menuOnRootPage(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/translated_pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/language_menu_fluid_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $expected = 'englishgerman'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); @@ -36,7 +41,7 @@ public function menuOnSubpage(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/translated_pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/language_menu_fluid_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/de/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/de/')); $expected = 'englishgerman'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); diff --git a/Tests/Functional/Frontend/ListMenuContentObjectTest.php b/Tests/Functional/Frontend/ListMenuContentObjectTest.php index ae4a8c6..2f8cf88 100644 --- a/Tests/Functional/Frontend/ListMenuContentObjectTest.php +++ b/Tests/Functional/Frontend/ListMenuContentObjectTest.php @@ -11,9 +11,14 @@ */ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class ListMenuContentObjectTest extends AbstractFrontendTest +class ListMenuContentObjectTest extends FunctionalTestCase { + protected array $testExtensionsToLoad = ['typo3conf/ext/menus']; + protected array $coreExtensionsToLoad = ['core', 'frontend']; + protected array $pathsToLinkInTestInstance = ['typo3conf/ext/menus/Build/sites' => 'typo3conf/sites']; + /** * @test */ @@ -21,7 +26,7 @@ public function menuOnRootPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/list_menu_content_object_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $expected = 'page-1'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); @@ -34,7 +39,7 @@ public function menuOnSubpage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/list_menu_content_object_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/page-1')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/page-1')); $expected = 'page-1'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); diff --git a/Tests/Functional/Frontend/ListMenuFluidTest.php b/Tests/Functional/Frontend/ListMenuFluidTest.php index dbe362f..270851d 100644 --- a/Tests/Functional/Frontend/ListMenuFluidTest.php +++ b/Tests/Functional/Frontend/ListMenuFluidTest.php @@ -11,9 +11,14 @@ */ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class ListMenuFluidTest extends AbstractFrontendTest +class ListMenuFluidTest extends FunctionalTestCase { + protected array $testExtensionsToLoad = ['typo3conf/ext/menus']; + protected array $coreExtensionsToLoad = ['core', 'frontend']; + protected array $pathsToLinkInTestInstance = ['typo3conf/ext/menus/Build/sites' => 'typo3conf/sites']; + /** * @test */ @@ -21,7 +26,7 @@ public function menuOnRootPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/list_menu_fluid_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $expected = 'page-1'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); @@ -34,7 +39,7 @@ public function menuOnSubpage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/list_menu_fluid_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/page-1')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/page-1')); $expected = 'page-1'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); diff --git a/Tests/Functional/Frontend/TreeMenuContentObjectTest.php b/Tests/Functional/Frontend/TreeMenuContentObjectTest.php index 8a22008..0a979f9 100644 --- a/Tests/Functional/Frontend/TreeMenuContentObjectTest.php +++ b/Tests/Functional/Frontend/TreeMenuContentObjectTest.php @@ -11,9 +11,14 @@ */ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class TreeMenuContentObjectTest extends AbstractFrontendTest +class TreeMenuContentObjectTest extends FunctionalTestCase { + protected array $testExtensionsToLoad = ['typo3conf/ext/menus']; + protected array $coreExtensionsToLoad = ['core', 'frontend']; + protected array $pathsToLinkInTestInstance = ['typo3conf/ext/menus/Build/sites' => 'typo3conf/sites']; + /** * @test */ @@ -21,7 +26,7 @@ public function menuOnRootPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/tree_menu_content_object_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $expected = 'page-1page-2'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); @@ -34,7 +39,7 @@ public function menuOnSubpage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/tree_menu_content_object_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/page-1')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/page-1')); $expected = 'page-1page-2'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); diff --git a/Tests/Functional/Frontend/TreeMenuFluidTest.php b/Tests/Functional/Frontend/TreeMenuFluidTest.php index 6553aa8..c1bf894 100644 --- a/Tests/Functional/Frontend/TreeMenuFluidTest.php +++ b/Tests/Functional/Frontend/TreeMenuFluidTest.php @@ -12,9 +12,14 @@ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class TreeMenuFluidTest extends AbstractFrontendTest +class TreeMenuFluidTest extends FunctionalTestCase { + protected array $testExtensionsToLoad = ['typo3conf/ext/menus']; + protected array $coreExtensionsToLoad = ['core', 'frontend']; + protected array $pathsToLinkInTestInstance = ['typo3conf/ext/menus/Build/sites' => 'typo3conf/sites']; + /** * @test */ @@ -22,7 +27,7 @@ public function menuOnRootPage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/tree_menu_fluid_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $expected = 'page-1page-2'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); @@ -35,7 +40,7 @@ public function menuOnSubpage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/tree_menu_fluid_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/page-1')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/page-1')); $expected = 'page-1page-2'; $body = (string)$response->getBody(); self::assertStringContainsString($expected, $body); @@ -48,7 +53,7 @@ public function menuWithAccessRestrictionForNotLoggedinUser(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/access_restriction.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/tree_menu_fluid_typoscript.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); self::assertStringContainsString('page-1', $body); self::assertStringNotContainsString('page-2', $body); @@ -63,7 +68,7 @@ public function menuWithAccessRestrictionForLoggedinUser(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/tree_menu_fluid_typoscript.csv'); $context = (new InternalRequestContext())->withFrontendUserId(1); $request = new InternalRequest('http://localhost/'); - $response = $this->executeFrontendRequestWrapper($request, $context); + $response = $this->executeFrontendSubRequest($request, $context); $body = (string)$response->getBody(); self::assertStringContainsString('page-1', $body); self::assertStringContainsString('page-2', $body); diff --git a/Tests/Functional/Hooks/DataHandlerTest.php b/Tests/Functional/Hooks/DataHandlerTest.php index 8ed04e0..3887bc1 100644 --- a/Tests/Functional/Hooks/DataHandlerTest.php +++ b/Tests/Functional/Hooks/DataHandlerTest.php @@ -11,10 +11,10 @@ */ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -44,11 +44,11 @@ protected function setUp(): void $this->importCSVDataSet(__DIR__ . '/../Fixtures/caches.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $this->backendUser = $GLOBALS['BE_USER'] = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->createFromUserPreferences($GLOBALS['BE_USER']); $this->dataHandler = GeneralUtility::makeInstance(DataHandler::class); } - public function cmdmapDataProvider(): array + public static function cmdmapDataProvider(): array { return [ 'copy page' => ['cmdmap' => ['pages' => [ @@ -104,7 +104,7 @@ protected function assertCacheIsEmpty(): void } $rows = $queryBuilder->select('*') ->from('cache_pages') - ->execute() + ->executeQuery() ->fetchAllAssociative(); self::assertSame(0, count($rows)); } diff --git a/Tests/Unit/Domain/Repository/MenuRepositoryTest.php b/Tests/Unit/Domain/Repository/MenuRepositoryTest.php index de54416..4c384ed 100644 --- a/Tests/Unit/Domain/Repository/MenuRepositoryTest.php +++ b/Tests/Unit/Domain/Repository/MenuRepositoryTest.php @@ -17,6 +17,8 @@ use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\LanguageAspect; use TYPO3\CMS\Core\Domain\Repository\PageRepository; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class MenuRepositoryTest extends UnitTestCase @@ -38,9 +40,11 @@ public function getSubPagesOfPageRestrictQueryToExcludeDoktypes(): void ->getMock(); $excludedDoktypes = [ PageRepository::DOKTYPE_BE_USER_SECTION, - PageRepository::DOKTYPE_RECYCLER, PageRepository::DOKTYPE_SYSFOLDER, ]; + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { + $excludedDoktypes[] = PageRepository::DOKTYPE_RECYCLER; + } $pageRepository->expects(self::once())->method('getMenu') ->with(1, '*', 'sorting', 'AND doktype NOT IN (' . implode(',', $excludedDoktypes) . ') ', false) ->willReturn([]); @@ -63,9 +67,11 @@ public function getSubPagesOfPageMergeExcludeDoktypesFromConfiguration(): void ->getMock(); $excludedDoktypes = [ PageRepository::DOKTYPE_BE_USER_SECTION, - PageRepository::DOKTYPE_RECYCLER, PageRepository::DOKTYPE_SYSFOLDER, ]; + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { + $excludedDoktypes[] = PageRepository::DOKTYPE_RECYCLER; + } $pageRepository->expects(self::once())->method('getMenu') ->with(1, '*', 'sorting', 'AND doktype NOT IN (' . implode(',', $excludedDoktypes) . ',99) ', false) ->willReturn([]); @@ -88,20 +94,40 @@ public function getBreadcrumbsMenuRespectConfiguredExcludeDoktypes(): void ->getMock(); $context->expects(self::once())->method('getAspect')->with('language')->willReturn($languageAspect); - $pageRepository = new class() extends PageRepository { - public function getPage($uid, $disableGroupAccessCheck = false) - { - if ($uid === 1) { - // $rootLine[0] - return ['uid' => 1, 'doktype' => 99, 'nav_hide'=> 0]; + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) { + $pageRepository = new class() extends PageRepository { + public function getPage($uid, $disableGroupAccessCheck = false) + { + if ($uid === 1) { + // $rootLine[0] + return ['uid' => 1, 'doktype' => 99, 'nav_hide'=> 0]; + } + if ($uid === 2) { + // $rootLine[0] + return ['uid' => 2, 'doktype' => 98, 'nav_hide'=> 0]; + } + return []; } - if ($uid === 2) { - // $rootLine[0] - return ['uid' => 2, 'doktype' => 98, 'nav_hide'=> 0]; + }; + } else { + $pageRepository = new class() extends PageRepository { + public function getPage(int $uid, bool $disableGroupAccessCheck = false): array + { + if ($uid === 1) { + // $rootLine[0] + return ['uid' => 1, 'doktype' => 99, 'nav_hide'=> 0]; + } + if ($uid === 2) { + // $rootLine[0] + return ['uid' => 2, 'doktype' => 98, 'nav_hide'=> 0]; + } + return []; } - return []; - } - }; + protected function init(): void + { + } + }; + } $menuRepository = $this->getMockBuilder(MenuRepository::class) ->onlyMethods(['populateAdditionalKeysForPage', 'isPageSuitableForLanguage']) diff --git a/composer.json b/composer.json index 1bb8c01..88b515d 100644 --- a/composer.json +++ b/composer.json @@ -4,18 +4,17 @@ "license": "GPL-2.0-or-later", "description": "Easy and fast menus for TYPO3 Frontends", "require": { - "php": "^7.4 || ~8.0", - "typo3/cms-core": "^10 || ^11 || ^12.4", - "typo3/cms-frontend": "^10 || ^11 || ^12.4" + "typo3/cms-core": "^11 || ^12.4 || ^13.1", + "typo3/cms-frontend": "^11 || ^12.4 || ^13.1" }, "require-dev": { - "phpstan/phpstan": "^1.8.11", - "phpunit/phpunit": "^9.5", - "typo3/cms-fluid-styled-content": "^11.5", - "typo3/cms-install": "^11.5", - "typo3/coding-standards": "^0.5", + "typo3/cms-fluid-styled-content": "^11 || ^12.4 || ^13.1", + "typo3/cms-install": "^11 || ^12.4 || ^13.1", + "typo3/coding-standards": "^0.5.5", + "saschaegerer/phpstan-typo3": "^1.8", "typo3/tailor": "^1.0", - "typo3/testing-framework": "^7" + "typo3/testing-framework": "^7.0 || ^8.0", + "phpunit/phpunit": "9.6 || ^10.5" }, "config": { "vendor-dir": ".Build/vendor", @@ -35,9 +34,6 @@ } }, "scripts": { - "prepare-tests-10": [ - "TYPO3\\TestingFramework\\Composer\\ExtensionTestEnvironment::prepare" - ], "prepare-tests": [ "if [ ! -e .Build/Web/typo3conf/sites -a -e .Build/Web/typo3conf ]; then cd .Build/Web/typo3conf && ln -s ../../../Build/sites && cd -; fi" ]