From 9978e9191c10d36432dd2c28df8c4a047d1df50e Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Thu, 21 Dec 2023 09:51:21 +0100 Subject: [PATCH] [TASK] Replace Bootstrap::initializeLanguageObject() in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change uses the LanguageServiceFactory directly (mostly in tests) instead of Bootstrap::initializeLanguageObject() in order to explicitly define $GLOBALS['LANG'], thus showing the dependency to the global object. The internal method Bootstrap::initializeLanguageObject() can thus be removed. Resolves: #102712 Releases: main Change-Id: I78a93e222d302db796a031e585685a409aa73c41 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82266 Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Nikita Hovratov <nikita.h@live.de> Tested-by: Oliver Klee <typo3-coding@oliverklee.de> Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Nikita Hovratov <nikita.h@live.de> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Tested-by: core-ci <typo3@b13.com> --- .../Shortcut/ShortcutRepositoryTest.php | 6 ++-- .../Functional/Clipboard/ClipboardTest.php | 6 ++-- .../Controller/BackendControllerTest.php | 6 ++-- .../Controller/EditDocumentControllerTest.php | 6 ++-- .../FormInlineAjaxControllerTest.php | 6 ++-- .../Controller/MfaAjaxControllerTest.php | 6 ++-- .../MfaConfigurationControllerTest.php | 6 ++-- .../Controller/MfaControllerTest.php | 6 ++-- .../Controller/MfaSetupControllerTest.php | 6 ++-- .../Page/LocalizationControllerTest.php | 34 +++++++++---------- .../Controller/Page/TreeControllerTest.php | 9 ++--- .../Controller/ShortcutControllerTest.php | 6 ++-- .../LocalizationRepositoryTest.php | 6 ++-- .../Form/FormDataProvider/TcaCategoryTest.php | 6 ++-- .../Form/FormDataProvider/TcaGroupTest.php | 6 ++-- .../Middleware/BackendModuleValidatorTest.php | 6 ++-- .../Buttons/Action/ShortcutButtonTest.php | 10 +++--- .../Functional/Utility/BackendUtilityTest.php | 4 +-- .../Drawing/BackendLayoutRendererTest.php | 4 +-- .../FlexFormValueFormatterTest.php | 6 ++-- typo3/sysext/core/Classes/Core/Bootstrap.php | 11 ------ .../Extension/ApplicationEnvironment.php | 4 ++- .../DataHandler/CheckboxValidationTest.php | 4 +-- .../DataHandler/DefaultValuesTest.php | 6 ++-- .../DeleteTranslatedSubpagesTest.php | 6 ++-- .../DataHandler/GetUniqueTranslationTest.php | 6 ++-- .../DataHandling/DataHandler/HookTest.php | 6 ++-- .../DataHandler/PagePermissionTest.php | 4 +-- .../DataHandling/DataHandler/SecurityTest.php | 19 +++-------- .../DataHandler/SelectCheckBoxTest.php | 4 +-- .../DataHandler/SlugUniqueTest.php | 6 ++-- .../DataHandler/TranslationDiffSourceTest.php | 6 ++-- .../DataHandling/Flexform/ActionTest.php | 6 ++-- .../DataHandling/FlexformIrre/ActionTest.php | 4 +-- .../DataHandling/Regular/CheckValueTest.php | 6 ++-- .../CheckValueTestForCheckboxesTest.php | 6 ++-- .../Regular/CheckValueTestForSelectTest.php | 6 ++-- .../Regular/Hooks/PagesTsConfigGuardTest.php | 11 +++--- .../DataHandling/Regular/MinValueTest.php | 7 ++-- .../Regular/MultiSite/MultiSiteTest.php | 6 ++-- .../DataHandling/Slug/SlugHelperTest.php | 6 ++-- .../AbstractDataHandlerActionTestCase.php | 4 +-- .../Functional/Log/LoggerAwareChannelTest.php | 6 ++-- .../Functional/Resource/ProcessedFileTest.php | 6 ++-- .../SynchronizeFolderRelationsTest.php | 15 ++++---- .../Aspect/PersistedAliasMapperTest.php | 4 +-- .../Aspect/PersistedPatternMapperTest.php | 4 +-- .../Utility/RootlineUtilityTest.php | 4 +-- .../Rendering/SecureHtmlRenderingTest.php | 4 +-- .../RequestHandling/RequestHandlingTest.php | 4 +-- .../SiteHandling/EidRequestTest.php | 4 +-- .../AbstractEnhancerLinkGeneratorTestCase.php | 4 +-- .../AbstractEnhancerSiteRequestTestCase.php | 4 +-- .../LinkGeneratorFreeModeTest.php | 8 ++--- .../AbstractLocalizedPagesTestCase.php | 4 +-- .../SiteHandling/MountPointTest.php | 4 +-- .../SiteHandling/RequestHandlerTest.php | 4 +-- .../SiteHandling/SiteRequestTest.php | 4 +-- .../SiteHandling/SlugLinkGeneratorTest.php | 8 ++--- ...esolutionByQueryParametersDisabledTest.php | 4 +-- ...ResolutionByQueryParametersEnabledTest.php | 4 +-- .../SiteHandling/SlugSiteRequestTest.php | 4 +-- ...lugSiteWithoutRequiredCHashRequestTest.php | 4 +-- .../SiteHandling/TypoLinkGeneratorTest.php | 4 +-- .../AbstractImportExportTestCase.php | 4 +-- .../Repository/BrokenLinkRepositoryTest.php | 6 ++-- .../Recycle/Pages/AdminRecycleTest.php | 6 ++-- .../Recycle/Pages/UserRecycleTest.php | 6 ++-- .../Controller/ManagementControllerTest.php | 6 ++-- .../Functional/Service/SlugServiceTest.php | 6 ++-- .../Controller/BrowseLinksControllerTest.php | 6 ++-- .../HrefLang/HrefLangGeneratorTest.php | 4 +-- .../Tests/Functional/WebhookExecutionTest.php | 6 ++-- .../PageTreeItemsHighlighterTest.php | 6 ++-- .../Functional/Hook/DataHandlerHookTest.php | 4 +-- .../Service/WorkspaceServiceTest.php | 6 ++-- 76 files changed, 227 insertions(+), 245 deletions(-) diff --git a/typo3/sysext/backend/Tests/Functional/Backend/Shortcut/ShortcutRepositoryTest.php b/typo3/sysext/backend/Tests/Functional/Backend/Shortcut/ShortcutRepositoryTest.php index caf18fb7a888..8f8de9b07b45 100644 --- a/typo3/sysext/backend/Tests/Functional/Backend/Shortcut/ShortcutRepositoryTest.php +++ b/typo3/sysext/backend/Tests/Functional/Backend/Shortcut/ShortcutRepositoryTest.php @@ -21,10 +21,10 @@ use TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository; use TYPO3\CMS\Backend\Module\ModuleProvider; use TYPO3\CMS\Backend\Routing\Router; use TYPO3\CMS\Backend\Routing\UriBuilder; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Imaging\IconFactory; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Routing\RequestContextFactory; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -37,8 +37,8 @@ final class ShortcutRepositoryTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/ShortcutsBase.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $request = new ServerRequest('https://localhost/typo3/'); $requestContextFactory = $this->get(RequestContextFactory::class); diff --git a/typo3/sysext/backend/Tests/Functional/Clipboard/ClipboardTest.php b/typo3/sysext/backend/Tests/Functional/Clipboard/ClipboardTest.php index 672ca79d9e17..82882d17afae 100644 --- a/typo3/sysext/backend/Tests/Functional/Clipboard/ClipboardTest.php +++ b/typo3/sysext/backend/Tests/Functional/Clipboard/ClipboardTest.php @@ -20,8 +20,8 @@ namespace TYPO3\CMS\Backend\Tests\Functional\Clipboard; use TYPO3\CMS\Backend\Clipboard\Clipboard; use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Routing\RequestContextFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -57,7 +57,7 @@ final class ClipboardTest extends FunctionalTestCase function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $this->backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUser); $scenarioFile = __DIR__ . '/../Fixtures/CommonScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($this->backendUser); @@ -66,7 +66,7 @@ final class ClipboardTest extends FunctionalTestCase }, function () { $this->backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUser); } ); } diff --git a/typo3/sysext/backend/Tests/Functional/Controller/BackendControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/BackendControllerTest.php index ac32022e14a5..c198a7aac6d0 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/BackendControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/BackendControllerTest.php @@ -21,10 +21,10 @@ use Symfony\Component\DependencyInjection\Container; use TYPO3\CMS\Backend\Controller\BackendController; use TYPO3\CMS\Backend\Controller\Event\AfterBackendPageRenderEvent; use TYPO3\CMS\Backend\Routing\Route; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\EventDispatcher\ListenerProvider; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Messaging\FlashMessageQueue; use TYPO3\CMS\Core\Messaging\FlashMessageService; @@ -40,8 +40,8 @@ final class BackendControllerTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/backend/Tests/Functional/Controller/EditDocumentControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/EditDocumentControllerTest.php index bb52f55be590..7cb93d439610 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/EditDocumentControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/EditDocumentControllerTest.php @@ -20,10 +20,10 @@ namespace TYPO3\CMS\Backend\Tests\Functional\Controller; use TYPO3\CMS\Backend\Controller\EditDocumentController; use TYPO3\CMS\Backend\Routing\Route; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -43,8 +43,8 @@ final class EditDocumentControllerTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/../Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/tt_content.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->subject = GeneralUtility::makeInstance(EditDocumentController::class); $this->normalizedParams = new NormalizedParams([], [], '', ''); diff --git a/typo3/sysext/backend/Tests/Functional/Controller/FormInlineAjaxControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/FormInlineAjaxControllerTest.php index 27b3b9c24ce0..a132081fec99 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/FormInlineAjaxControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/FormInlineAjaxControllerTest.php @@ -20,8 +20,8 @@ namespace TYPO3\CMS\Backend\Tests\Functional\Controller; use TYPO3\CMS\Backend\Controller\FormInlineAjaxController; use TYPO3\CMS\Backend\Form\FormDataCompiler; use TYPO3\CMS\Backend\Routing\Route; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -54,8 +54,8 @@ final class FormInlineAjaxControllerTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/../Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/tx_testirrecsv_hotel.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->writeSiteConfiguration( 'website-local', diff --git a/typo3/sysext/backend/Tests/Functional/Controller/MfaAjaxControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/MfaAjaxControllerTest.php index 38d51bb9e1fb..415ec447e065 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/MfaAjaxControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/MfaAjaxControllerTest.php @@ -20,9 +20,9 @@ namespace TYPO3\CMS\Backend\Tests\Functional\Controller; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Backend\Controller\MfaAjaxController; use TYPO3\CMS\Core\Authentication\Mfa\MfaProviderRegistry; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; final class MfaAjaxControllerTest extends FunctionalTestCase @@ -34,8 +34,8 @@ final class MfaAjaxControllerTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users_mfa.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->subject = new MfaAjaxController($this->get(MfaProviderRegistry::class)); diff --git a/typo3/sysext/backend/Tests/Functional/Controller/MfaConfigurationControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/MfaConfigurationControllerTest.php index ce38183d0f81..0d1ff55f9b84 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/MfaConfigurationControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/MfaConfigurationControllerTest.php @@ -24,12 +24,12 @@ use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use TYPO3\CMS\Core\Authentication\Mfa\MfaProviderRegistry; use TYPO3\CMS\Core\Authentication\Mfa\Provider\Totp; use TYPO3\CMS\Core\Context\Context; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Imaging\IconFactory; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -51,8 +51,8 @@ final class MfaConfigurationControllerTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->subject = new MfaConfigurationController( $this->get(IconFactory::class), diff --git a/typo3/sysext/backend/Tests/Functional/Controller/MfaControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/MfaControllerTest.php index 6550e2e729f9..fc26b4beebf1 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/MfaControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/MfaControllerTest.php @@ -27,9 +27,9 @@ use TYPO3\CMS\Core\Authentication\Mfa\MfaProviderRegistry; use TYPO3\CMS\Core\Authentication\Mfa\Provider\Totp; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Context\Context; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Log\Logger; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -58,8 +58,8 @@ final class MfaControllerTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->subject = new MfaController( $this->get(UriBuilder::class), diff --git a/typo3/sysext/backend/Tests/Functional/Controller/MfaSetupControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/MfaSetupControllerTest.php index a56dbd8a78c7..c48c6b3aa403 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/MfaSetupControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/MfaSetupControllerTest.php @@ -27,9 +27,9 @@ use TYPO3\CMS\Core\Authentication\Mfa\MfaProviderRegistry; use TYPO3\CMS\Core\Authentication\Mfa\Provider\Totp; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Context\Context; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -58,9 +58,9 @@ final class MfaSetupControllerTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); $GLOBALS['TYPO3_CONF_VARS']['BE']['requireMfa'] = 1; - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->subject = new MfaSetupController( $this->get(UriBuilder::class), diff --git a/typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php index 5536a9a74f42..b01edec263dd 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php @@ -18,9 +18,9 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\Controller\Page; use TYPO3\CMS\Backend\Controller\Page\LocalizationController; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -59,8 +59,8 @@ final class LocalizationControllerTest extends FunctionalTestCase */ public function recordsGetTranslatedFromDefaultLanguage(): void { - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $params = [ 'pageId' => 1, 'srcLanguageId' => 0, @@ -79,8 +79,8 @@ final class LocalizationControllerTest extends FunctionalTestCase public function recordsGetTranslatedFromDifferentTranslation(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/tt_content-danish-language.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $params = [ 'pageId' => 1, 'srcLanguageId' => 1, @@ -98,8 +98,8 @@ final class LocalizationControllerTest extends FunctionalTestCase */ public function recordsGetCopiedFromDefaultLanguage(): void { - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $params = [ 'pageId' => 1, 'srcLanguageId' => 0, @@ -118,8 +118,8 @@ final class LocalizationControllerTest extends FunctionalTestCase public function recordsGetCopiedFromAnotherLanguage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/tt_content-danish-language.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $params = [ 'pageId' => 1, 'srcLanguageId' => 1, @@ -146,8 +146,8 @@ final class LocalizationControllerTest extends FunctionalTestCase */ public function copyingNewContentFromLanguageIntoExistingLocalizationHasSameOrdering(): void { - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $params = [ 'pageId' => 1, 'srcLanguageId' => 0, @@ -191,8 +191,8 @@ final class LocalizationControllerTest extends FunctionalTestCase public function defaultLanguageIsFoundAsOriginLanguage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/tt_content-danish-language.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); // Create another content element in default language $data = [ 'tt_content' => [ @@ -223,8 +223,8 @@ final class LocalizationControllerTest extends FunctionalTestCase { $this->importCSVDataSet(__DIR__ . '/Fixtures/tt_content-default-language-deleted-element.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/tt_content-danish-language-deleted-source.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $request = (new ServerRequest())->withQueryParams([ 'pageId' => 2, // page uid, the records are stored on 'languageId' => 1, // current language id @@ -241,7 +241,7 @@ final class LocalizationControllerTest extends FunctionalTestCase { // Delete record 2 within workspace 1 $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $backendUser->workspace = 1; $actionService = new ActionService(); $actionService->deleteRecord('tt_content', 2); @@ -283,7 +283,7 @@ final class LocalizationControllerTest extends FunctionalTestCase { // Move record 2 to page 2 within workspace 1 $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $backendUser->workspace = 1; $actionService = new ActionService(); $actionService->moveRecord('tt_content', 2, 2); diff --git a/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php index 77b501b11276..5ff39df06b2e 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php @@ -25,10 +25,10 @@ use TYPO3\CMS\Backend\Tests\Functional\Tree\Repository\Fixtures\Tree\NormalizeTr use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\WorkspaceAspect; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\EventDispatcher\ListenerProvider; use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Http\Uri; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\AccessibleObjectInterface; @@ -59,12 +59,15 @@ final class TreeControllerTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/Fixtures/be_users.csv'); // Admin user for importing dataset $this->backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUser); $scenarioFile = __DIR__ . '/Fixtures/PagesWithBEPermissions.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($this->backendUser); $writer->invokeFactory($factory); static::failIfArrayIsNotEmpty($writer->getErrors()); + }, function () { + $this->backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUser); }); // Regular editor, non admin @@ -709,8 +712,6 @@ final class TreeControllerTest extends FunctionalTestCase */ public function pageTreeItemsModificationEventIsTriggered(): void { - Bootstrap::initializeLanguageObject(); - $afterPageTreeItemsPreparedEvent = null; /** @var Container $container */ diff --git a/typo3/sysext/backend/Tests/Functional/Controller/ShortcutControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/ShortcutControllerTest.php index 0eed175064a0..bc4d68c0c881 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/ShortcutControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/ShortcutControllerTest.php @@ -21,9 +21,9 @@ use TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository; use TYPO3\CMS\Backend\Backend\ToolbarItems\ShortcutToolbarItem; use TYPO3\CMS\Backend\Controller\ShortcutController; use TYPO3\CMS\Backend\View\BackendViewFactory; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Package\PackageManager; use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -39,8 +39,8 @@ final class ShortcutControllerTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/../Fixtures/sys_be_shortcuts.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->subject = new ShortcutController( $this->get(ShortcutToolbarItem::class), diff --git a/typo3/sysext/backend/Tests/Functional/Domain/Repository/Localization/LocalizationRepositoryTest.php b/typo3/sysext/backend/Tests/Functional/Domain/Repository/Localization/LocalizationRepositoryTest.php index ab5ebda26124..a393dbb90d9e 100644 --- a/typo3/sysext/backend/Tests/Functional/Domain/Repository/Localization/LocalizationRepositoryTest.php +++ b/typo3/sysext/backend/Tests/Functional/Domain/Repository/Localization/LocalizationRepositoryTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\Domain\Repository\Localization; use TYPO3\CMS\Backend\Domain\Repository\Localization\LocalizationRepository; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; final class LocalizationRepositoryTest extends FunctionalTestCase @@ -32,8 +32,8 @@ final class LocalizationRepositoryTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../../../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultPagesAndContent.csv'); diff --git a/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaCategoryTest.php b/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaCategoryTest.php index 34e786110c52..5cf8435f600c 100644 --- a/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaCategoryTest.php +++ b/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaCategoryTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\Form\FormDataProvider; use TYPO3\CMS\Backend\Form\FormDataProvider\TcaCategory; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -29,8 +29,8 @@ final class TcaCategoryTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/CategoryRelations.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaGroupTest.php b/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaGroupTest.php index bd4df2f78cb4..ac174ca03d9c 100644 --- a/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaGroupTest.php +++ b/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaGroupTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\Form\FormDataProvider; use TYPO3\CMS\Backend\Form\FormDataProvider\TcaGroup; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; final class TcaGroupTest extends FunctionalTestCase @@ -29,8 +29,8 @@ final class TcaGroupTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->importCSVDataSet(__DIR__ . '/../Fixtures/TcaGroup.csv'); } diff --git a/typo3/sysext/backend/Tests/Functional/Middleware/BackendModuleValidatorTest.php b/typo3/sysext/backend/Tests/Functional/Middleware/BackendModuleValidatorTest.php index 1ec5aa66da36..8669a8e0abb0 100644 --- a/typo3/sysext/backend/Tests/Functional/Middleware/BackendModuleValidatorTest.php +++ b/typo3/sysext/backend/Tests/Functional/Middleware/BackendModuleValidatorTest.php @@ -26,9 +26,9 @@ use TYPO3\CMS\Backend\Module\ModuleFactory; use TYPO3\CMS\Backend\Module\ModuleProvider; use TYPO3\CMS\Backend\Routing\Route; use TYPO3\CMS\Backend\Routing\UriBuilder; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Http\Response; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Messaging\FlashMessageQueue; use TYPO3\CMS\Core\Messaging\FlashMessageService; @@ -46,8 +46,8 @@ final class BackendModuleValidatorTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->subject = new BackendModuleValidator( $this->get(UriBuilder::class), diff --git a/typo3/sysext/backend/Tests/Functional/Template/Components/Buttons/Action/ShortcutButtonTest.php b/typo3/sysext/backend/Tests/Functional/Template/Components/Buttons/Action/ShortcutButtonTest.php index 1c097196dc12..d0fea8a45e5d 100644 --- a/typo3/sysext/backend/Tests/Functional/Template/Components/Buttons/Action/ShortcutButtonTest.php +++ b/typo3/sysext/backend/Tests/Functional/Template/Components/Buttons/Action/ShortcutButtonTest.php @@ -18,10 +18,10 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\Template\Components\Buttons\Action; use TYPO3\CMS\Backend\Template\Components\Buttons\Action\ShortcutButton; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; final class ShortcutButtonTest extends FunctionalTestCase @@ -45,8 +45,8 @@ final class ShortcutButtonTest extends FunctionalTestCase public function buttonIsNotRenderedForUserWithInsufficientPermissions(): void { $this->importCSVDataSet(__DIR__ . '/../../../../Fixtures/be_users_no_bookmarks.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); self::assertEmpty( (new ShortcutButton())->setRouteIdentifier('web_list')->setDisplayName('Some module anme')->render() ); @@ -59,8 +59,8 @@ final class ShortcutButtonTest extends FunctionalTestCase public function rendersCorrectMarkup(ShortcutButton $button, string $expectedMarkupFile): void { $this->importCSVDataSet(__DIR__ . '/../../../../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $serverParams = array_replace($_SERVER, ['HTTP_HOST' => 'example.com', 'SCRIPT_NAME' => '/typo3/index.php']); $request = new ServerRequest('http://example.com/typo3/index.php', 'GET', null, $serverParams); $GLOBALS['TYPO3_REQUEST'] = $request diff --git a/typo3/sysext/backend/Tests/Functional/Utility/BackendUtilityTest.php b/typo3/sysext/backend/Tests/Functional/Utility/BackendUtilityTest.php index 2b4f878f8377..9c0e40477b9d 100644 --- a/typo3/sysext/backend/Tests/Functional/Utility/BackendUtilityTest.php +++ b/typo3/sysext/backend/Tests/Functional/Utility/BackendUtilityTest.php @@ -21,8 +21,8 @@ use Doctrine\DBAL\Platforms\PostgreSQLPlatform as DoctrinePostgreSQLPlatform; use Doctrine\DBAL\Platforms\SqlitePlatform as DoctrineSQLitePlatform; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -46,7 +46,7 @@ final class BackendUtilityTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/../Fixtures/tt_content.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $this->backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUser); } /** diff --git a/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php b/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php index 411c0059761a..f1d599a7e421 100644 --- a/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php +++ b/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php @@ -23,7 +23,7 @@ use TYPO3\CMS\Backend\View\BackendViewFactory; use TYPO3\CMS\Backend\View\Drawing\BackendLayoutRenderer; use TYPO3\CMS\Backend\View\PageLayoutContext; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Package\PackageManager; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory; @@ -50,7 +50,7 @@ final class BackendLayoutRendererTest extends FunctionalTestCase function () { $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); $this->backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUser); $scenarioFile = __DIR__ . '/../Fixtures/DefaultViewScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($this->backendUser); diff --git a/typo3/sysext/backend/Tests/Functional/View/ValueFormatter/FlexFormValueFormatterTest.php b/typo3/sysext/backend/Tests/Functional/View/ValueFormatter/FlexFormValueFormatterTest.php index ed4e4812510b..36a5e73cdee9 100644 --- a/typo3/sysext/backend/Tests/Functional/View/ValueFormatter/FlexFormValueFormatterTest.php +++ b/typo3/sysext/backend/Tests/Functional/View/ValueFormatter/FlexFormValueFormatterTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\View\ValueFormatter; use TYPO3\CMS\Backend\View\ValueFormatter\FlexFormValueFormatter; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; final class FlexFormValueFormatterTest extends FunctionalTestCase @@ -27,8 +27,8 @@ final class FlexFormValueFormatterTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet('typo3/sysext/backend/Tests/Functional/Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index e99b51a55e3e..db89b48d76ff 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -38,7 +38,6 @@ use TYPO3\CMS\Core\Configuration\Tca\TcaFactory; use TYPO3\CMS\Core\Core\Event\BootCompletedEvent; use TYPO3\CMS\Core\DependencyInjection\Cache\ContainerBackend; use TYPO3\CMS\Core\DependencyInjection\ContainerBuilder; -use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Log\LogManager; use TYPO3\CMS\Core\Package\Cache\ComposerPackageArtifact; use TYPO3\CMS\Core\Package\Cache\PackageCacheInterface; @@ -530,14 +529,4 @@ class Bootstrap { $GLOBALS['BE_USER']->backendCheckLogin(); } - - /** - * Initialize language object - * - * @internal This is not a public API method, do not use in own extensions - */ - public static function initializeLanguageObject() - { - $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->createFromUserPreferences($GLOBALS['BE_USER']); - } } diff --git a/typo3/sysext/core/Tests/Acceptance/Support/Extension/ApplicationEnvironment.php b/typo3/sysext/core/Tests/Acceptance/Support/Extension/ApplicationEnvironment.php index c541b779f00a..9b3bad9b54b3 100644 --- a/typo3/sysext/core/Tests/Acceptance/Support/Extension/ApplicationEnvironment.php +++ b/typo3/sysext/core/Tests/Acceptance/Support/Extension/ApplicationEnvironment.php @@ -24,6 +24,8 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Styleguide\TcaDataGenerator\Generator; use TYPO3\CMS\Styleguide\TcaDataGenerator\GeneratorFrontend; use TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment; @@ -100,7 +102,7 @@ final class ApplicationEnvironment extends BackendEnvironment $GLOBALS['BE_USER']->user['admin'] = 1; $GLOBALS['BE_USER']->user['uid'] = 1; $GLOBALS['BE_USER']->workspace = 0; - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->createFromUserPreferences($GLOBALS['BE_USER']); $faviconLinkPath = '../../../../favicon.ico'; if (!is_file($faviconLinkPath)) { diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/CheckboxValidationTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/CheckboxValidationTest.php index 41c2f53ecf16..b2eec9f6bf78 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/CheckboxValidationTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/CheckboxValidationTest.php @@ -21,7 +21,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\WorkspaceAspect; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -62,7 +62,7 @@ final class CheckboxValidationTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/DataSet/CheckboxRecordsEval.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); $this->backendUserAuthentication = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUserAuthentication); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DefaultValuesTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DefaultValuesTest.php index 192c5e4e6853..6287f69dbf93 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DefaultValuesTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DefaultValuesTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -46,9 +46,9 @@ final class DefaultValuesTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); $this->importCSVDataSet(__DIR__ . '/DataSet/LiveDefaultPages.csv'); - $this->setUpBackendUser(1); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->actionService = new ActionService(); - Bootstrap::initializeLanguageObject(); $this->writeSiteConfiguration( 'test', $this->buildSiteConfiguration(1), diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DeleteTranslatedSubpagesTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DeleteTranslatedSubpagesTest.php index 7fcd0f28ee09..5670a744a7e2 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DeleteTranslatedSubpagesTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DeleteTranslatedSubpagesTest.php @@ -17,8 +17,8 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\DataHandling\DataHandler; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -34,8 +34,8 @@ final class DeleteTranslatedSubpagesTest extends FunctionalTestCase { $this->importCSVDataSet(__DIR__ . '/DataSet/TranslatedSubpages.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $cmd['pages'][1]['delete'] = 1; $dataHandler = GeneralUtility::makeInstance(DataHandler::class); $dataHandler->start([], $cmd); diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/GetUniqueTranslationTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/GetUniqueTranslationTest.php index 8bf52b9dc142..bddc62d59646 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/GetUniqueTranslationTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/GetUniqueTranslationTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -47,8 +47,8 @@ final class GetUniqueTranslationTest extends FunctionalTestCase $this->buildLanguageConfiguration('DA', '/da/'), ], ); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/HookTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/HookTest.php index 6b0423cf3919..aed12c8a0fc5 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/HookTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/HookTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler\Fixtures\HookFixture; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\StringUtility; @@ -60,8 +60,8 @@ final class HookTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/DataSet/LiveDefaultPages.csv'); $this->importCSVDataSet(__DIR__ . '/DataSet/LiveDefaultElements.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/PagePermissionTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/PagePermissionTest.php index d1ff11035b66..8f5a4e3d8212 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/PagePermissionTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/PagePermissionTest.php @@ -19,7 +19,7 @@ namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Type\Bitmask\Permission; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -52,8 +52,8 @@ final class PagePermissionTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); $this->importCSVDataSet(__DIR__ . '/DataSet/LiveDefaultPages.csv'); $this->backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUser); $this->actionService = new ActionService(); - Bootstrap::initializeLanguageObject(); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SecurityTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SecurityTest.php index b4f5c8c3cbf9..e1919a3c8cee 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SecurityTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SecurityTest.php @@ -17,11 +17,10 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; -use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\WorkspaceAspect; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -31,15 +30,7 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; */ final class SecurityTest extends FunctionalTestCase { - /** - * @var BackendUserAuthentication - */ - private $backendUser; - - /** - * @var ActionService - */ - private $actionService; + private ActionService $actionService; protected array $coreExtensionsToLoad = ['rte_ckeditor']; @@ -48,11 +39,11 @@ final class SecurityTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/DataSet/pages.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); - $this->backendUser = $this->setUpBackendUser(1); - $this->backendUser->workspace = 0; + $backendUser = $this->setUpBackendUser(1); + $backendUser->workspace = 0; GeneralUtility::makeInstance(Context::class) ->setAspect('workspace', new WorkspaceAspect(0)); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->actionService = GeneralUtility::makeInstance(ActionService::class); } diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SelectCheckBoxTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SelectCheckBoxTest.php index f82b6c032dd2..9685dac41208 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SelectCheckBoxTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SelectCheckBoxTest.php @@ -19,7 +19,7 @@ namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -33,7 +33,7 @@ final class SelectCheckBoxTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); $this->backendUserAuthentication = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUserAuthentication); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SlugUniqueTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SlugUniqueTest.php index ac635eefda33..502ec9d68999 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SlugUniqueTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SlugUniqueTest.php @@ -17,8 +17,8 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\DataHandling\DataHandler; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -46,8 +46,8 @@ final class SlugUniqueTest extends FunctionalTestCase ], $this->buildErrorHandlingConfiguration('Fluid', [404]), ); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } public static function getEvalSettingDataProvider(): array diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/TranslationDiffSourceTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/TranslationDiffSourceTest.php index 38d168f88710..16d06e27345b 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/TranslationDiffSourceTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/TranslationDiffSourceTest.php @@ -20,7 +20,7 @@ namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; use TYPO3\CMS\Backend\History\RecordHistory; use TYPO3\CMS\Backend\History\RecordHistoryRollback; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; @@ -50,8 +50,8 @@ final class TranslationDiffSourceTest extends FunctionalTestCase ], $this->buildErrorHandlingConfiguration('Fluid', [404]), ); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Flexform/ActionTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/Flexform/ActionTest.php index b890c1015605..1abd483b7e6b 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/Flexform/ActionTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/Flexform/ActionTest.php @@ -17,8 +17,8 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Flexform; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\Connection; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -32,8 +32,8 @@ final class ActionTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/DataSet/LiveDefaultPages.csv'); $this->importCSVDataSet(__DIR__ . '/DataSet/LiveDefaultElements.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/FlexformIrre/ActionTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/FlexformIrre/ActionTest.php index ad0d5b033a42..148642ce668d 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/FlexformIrre/ActionTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/FlexformIrre/ActionTest.php @@ -17,8 +17,8 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\FlexformIrre; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\Connection; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -42,7 +42,7 @@ final class ActionTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/DataSet/ImportDefault.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $backendUser->workspace = 1; $actionService = new ActionService(); $actionService->modifyRecords(1, [ diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTest.php index 67c86668f769..aeacd4c7882c 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -36,8 +36,8 @@ final class CheckValueTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/DataSet/ImportDefault.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } private function insertRecordWithRadioFieldValue($value): array diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTestForCheckboxesTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTestForCheckboxesTest.php index a3631195cc1c..94e4a884bb7f 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTestForCheckboxesTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTestForCheckboxesTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -36,8 +36,8 @@ final class CheckValueTestForCheckboxesTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/DataSet/ImportDefault.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTestForSelectTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTestForSelectTest.php index 6b9349f08230..2037cdfb6485 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTestForSelectTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/CheckValueTestForSelectTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -36,8 +36,8 @@ final class CheckValueTestForSelectTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/DataSet/ImportDefault.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users_admin.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/Hooks/PagesTsConfigGuardTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/Hooks/PagesTsConfigGuardTest.php index 4ca7e7c0f8ce..f66e1b49c987 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/Hooks/PagesTsConfigGuardTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/Hooks/PagesTsConfigGuardTest.php @@ -18,9 +18,9 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Hooks; 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\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Type\Bitmask\Permission; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -41,6 +41,7 @@ final class PagesTsConfigGuardTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/../DataSet/ImportDefault.csv'); $this->importCSVDataSet(__DIR__ . '/../../../Fixtures/be_groups.csv'); $this->importCSVDataSet(__DIR__ . '/../../../Fixtures/be_users.csv'); + $this->writeSiteConfiguration( 'test', $this->buildSiteConfiguration(1, '/'), @@ -63,9 +64,9 @@ final class PagesTsConfigGuardTest extends FunctionalTestCase */ public function pagesTsConfigIsConsideredForAdminUser(): void { - $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); $identifier = StringUtility::getUniqueId('NEW'); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $dataMap = [ 'pages' => [ @@ -87,9 +88,9 @@ final class PagesTsConfigGuardTest extends FunctionalTestCase */ public function pagesTsConfigIsIgnoredForNonAdminUser(): void { - $backendUser = $this->setUpBackendUser(9); - Bootstrap::initializeLanguageObject(); $identifier = StringUtility::getUniqueId('NEW'); + $backendUser = $this->setUpBackendUser(9); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $dataMap = [ 'pages' => [ diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MinValueTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MinValueTest.php index ebb0e751279d..3e53caa0fdae 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MinValueTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MinValueTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -36,9 +36,8 @@ final class MinValueTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/DataSet/MinValuePages.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } public static function valuesLowerThanMinResetToEmptyStringDataProvider(): iterable diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MultiSite/MultiSiteTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MultiSite/MultiSiteTest.php index 70f564dd9a32..479fc9a861df 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MultiSite/MultiSiteTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MultiSite/MultiSiteTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSite; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Routing\SiteMatcher; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -62,8 +62,8 @@ final class MultiSiteTest extends FunctionalTestCase */ public function moveRootPageToDifferentPageTree(): void { - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); // Warm up caches for the root line utility to identify side effects GeneralUtility::makeInstance(SiteMatcher::class)->matchByPageId(self::VALUE_PageIdWebsite); diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Slug/SlugHelperTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/Slug/SlugHelperTest.php index 8856346f7001..cf82ff1b01e0 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/Slug/SlugHelperTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/Slug/SlugHelperTest.php @@ -17,8 +17,8 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\Slug; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\DataHandling\SlugHelper; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -52,8 +52,8 @@ final class SlugHelperTest extends FunctionalTestCase $this->buildLanguageConfiguration('CH', '/de-CH/', ['DE', 'EN']), ], ); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/core/Tests/Functional/DataScenarios/AbstractDataHandlerActionTestCase.php b/typo3/sysext/core/Tests/Functional/DataScenarios/AbstractDataHandlerActionTestCase.php index f9517dcc2d63..ef3602b83693 100644 --- a/typo3/sysext/core/Tests/Functional/DataScenarios/AbstractDataHandlerActionTestCase.php +++ b/typo3/sysext/core/Tests/Functional/DataScenarios/AbstractDataHandlerActionTestCase.php @@ -20,9 +20,9 @@ namespace TYPO3\CMS\Core\Tests\Functional\DataScenarios; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\WorkspaceAspect; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ReferenceIndex; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Log\LogDataTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; @@ -61,7 +61,7 @@ abstract class AbstractDataHandlerActionTestCase extends FunctionalTestCase // Note late static binding - Workspace related tests override the constant $this->setWorkspaceId(static::VALUE_WorkspaceId); $this->actionService = new ActionService(); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUser); } protected function tearDown(): void diff --git a/typo3/sysext/core/Tests/Functional/Log/LoggerAwareChannelTest.php b/typo3/sysext/core/Tests/Functional/Log/LoggerAwareChannelTest.php index 8d42bb38863c..23e74428f8cb 100644 --- a/typo3/sysext/core/Tests/Functional/Log/LoggerAwareChannelTest.php +++ b/typo3/sysext/core/Tests/Functional/Log/LoggerAwareChannelTest.php @@ -18,7 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\Log; use Psr\Log\LogLevel; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Log\LogRecord; use TYPO3\CMS\Core\Tests\Functional\Fixtures\Log\DummyWriter; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -47,8 +47,8 @@ final class LoggerAwareChannelTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); DummyWriter::$logs = []; } diff --git a/typo3/sysext/core/Tests/Functional/Resource/ProcessedFileTest.php b/typo3/sysext/core/Tests/Functional/Resource/ProcessedFileTest.php index 6ac7ad9ae622..85e389bc15eb 100644 --- a/typo3/sysext/core/Tests/Functional/Resource/ProcessedFileTest.php +++ b/typo3/sysext/core/Tests/Functional/Resource/ProcessedFileTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\Resource; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Resource\ProcessedFile; use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -38,8 +38,8 @@ final class ProcessedFileTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/core/Tests/Functional/Resource/SynchronizeFolderRelationsTest.php b/typo3/sysext/core/Tests/Functional/Resource/SynchronizeFolderRelationsTest.php index abc9c3a38ea5..d80536794ee5 100644 --- a/typo3/sysext/core/Tests/Functional/Resource/SynchronizeFolderRelationsTest.php +++ b/typo3/sysext/core/Tests/Functional/Resource/SynchronizeFolderRelationsTest.php @@ -17,15 +17,14 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\Resource; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Resource\Driver\LocalDriver; use TYPO3\CMS\Core\Resource\Event\AfterFolderRenamedEvent; use TYPO3\CMS\Core\Resource\Folder; use TYPO3\CMS\Core\Resource\ResourceStorage; use TYPO3\CMS\Core\Resource\SynchronizeFolderRelations; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; final class SynchronizeFolderRelationsTest extends FunctionalTestCase @@ -37,12 +36,12 @@ final class SynchronizeFolderRelationsTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->subject = new SynchronizeFolderRelations( - GeneralUtility::makeInstance(ConnectionPool::class), - GeneralUtility::makeInstance(FlashMessageService::class) + $this->get(ConnectionPool::class), + $this->get(FlashMessageService::class) ); } @@ -62,7 +61,7 @@ final class SynchronizeFolderRelationsTest extends FunctionalTestCase $this->assertCSVDataSet(__DIR__ . '/Fixtures/FilemountsResult.csv'); // Check for generated flash messages - $flashMessages = GeneralUtility::makeInstance(FlashMessageService::class)->getMessageQueueByIdentifier()->getAllMessages(); + $flashMessages = $this->get(FlashMessageService::class)->getMessageQueueByIdentifier()->getAllMessages(); self::assertNotEmpty($flashMessages); // Check flash message content @@ -86,7 +85,7 @@ final class SynchronizeFolderRelationsTest extends FunctionalTestCase $this->assertCSVDataSet(__DIR__ . '/Fixtures/FileCollectionResult.csv'); // Check for generated flash messages - $flashMessages = GeneralUtility::makeInstance(FlashMessageService::class)->getMessageQueueByIdentifier()->getAllMessages(); + $flashMessages = $this->get(FlashMessageService::class)->getMessageQueueByIdentifier()->getAllMessages(); self::assertNotEmpty($flashMessages); // Check flash message content diff --git a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php index 44a2cc912ccf..fd9d8e5e673b 100644 --- a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php +++ b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php @@ -23,7 +23,7 @@ use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\DateTimeAspect; use TYPO3\CMS\Core\Context\UserAspect; use TYPO3\CMS\Core\Context\VisibilityAspect; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Routing\Aspect\PersistedAliasMapper; use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -73,7 +73,7 @@ final class PersistedAliasMapperTest extends FunctionalTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/AspectScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php index 2cbbcf77e03d..8cf5f71fc9a6 100644 --- a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php +++ b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php @@ -23,7 +23,7 @@ use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\DateTimeAspect; use TYPO3\CMS\Core\Context\UserAspect; use TYPO3\CMS\Core\Context\VisibilityAspect; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Routing\Aspect\PersistedPatternMapper; use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -81,7 +81,7 @@ final class PersistedPatternMapperTest extends FunctionalTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/AspectScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/core/Tests/Functional/Utility/RootlineUtilityTest.php b/typo3/sysext/core/Tests/Functional/Utility/RootlineUtilityTest.php index 2b3d03167401..500af19743a3 100644 --- a/typo3/sysext/core/Tests/Functional/Utility/RootlineUtilityTest.php +++ b/typo3/sysext/core/Tests/Functional/Utility/RootlineUtilityTest.php @@ -19,8 +19,8 @@ namespace TYPO3\CMS\Core\Tests\Functional\Utility; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\WorkspaceAspect; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Exception\Page\PageNotFoundException; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\RootlineUtility; @@ -57,7 +57,7 @@ final class RootlineUtilityTest extends FunctionalTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $factory = DataHandlerFactory::fromYamlFile(__DIR__ . '/Fixtures/RootlineScenario.yaml'); $writer = DataHandlerWriter::withBackendUser($backendUser); $writer->invokeFactory($factory); diff --git a/typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/SecureHtmlRenderingTest.php b/typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/SecureHtmlRenderingTest.php index a41ed8324c94..2d167e40fe4c 100644 --- a/typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/SecureHtmlRenderingTest.php +++ b/typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/SecureHtmlRenderingTest.php @@ -16,7 +16,7 @@ namespace TYPO3\CMS\FluidStyledContent\Tests\Functional\Rendering; use Psr\Http\Message\ResponseInterface; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; @@ -56,7 +56,7 @@ final class SecureHtmlRenderingTest extends FunctionalTestCase { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/SecureHtmlScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); diff --git a/typo3/sysext/form/Tests/Functional/RequestHandling/RequestHandlingTest.php b/typo3/sysext/form/Tests/Functional/RequestHandling/RequestHandlingTest.php index ddb330314885..389240479a03 100644 --- a/typo3/sysext/form/Tests/Functional/RequestHandling/RequestHandlingTest.php +++ b/typo3/sysext/form/Tests/Functional/RequestHandling/RequestHandlingTest.php @@ -20,7 +20,7 @@ namespace TYPO3\CMS\Form\Tests\Functional\RequestHandling; use Symfony\Component\Mailer\SentMessage; use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend; use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Mail\FluidEmail; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Form\Tests\Functional\Framework\FormHandling\FormDataFactory; @@ -87,7 +87,7 @@ final class RequestHandlingTest extends FunctionalTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $factory = DataHandlerFactory::fromYamlFile($this->databaseScenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); $writer->invokeFactory($factory); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EidRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EidRequestTest.php index b97517cd696b..992c834ed87e 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EidRequestTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EidRequestTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; @@ -34,7 +34,7 @@ final class EidRequestTest extends AbstractTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/PlainScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerLinkGenerator/AbstractEnhancerLinkGeneratorTestCase.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerLinkGenerator/AbstractEnhancerLinkGeneratorTestCase.php index df8f620d72e6..ad9aaef86bcc 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerLinkGenerator/AbstractEnhancerLinkGeneratorTestCase.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerLinkGenerator/AbstractEnhancerLinkGeneratorTestCase.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerLinkGenerator; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase; use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Builder; use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\LanguageContext; @@ -55,7 +55,7 @@ abstract class AbstractEnhancerLinkGeneratorTestCase extends AbstractTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/../Fixtures/SlugScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequest/AbstractEnhancerSiteRequestTestCase.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequest/AbstractEnhancerSiteRequestTestCase.php index 3b27b69e5640..9a730216b21a 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequest/AbstractEnhancerSiteRequestTestCase.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequest/AbstractEnhancerSiteRequestTestCase.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerSiteRequest; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase; use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Builder; use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\ExceptionExpectation; @@ -56,7 +56,7 @@ abstract class AbstractEnhancerSiteRequestTestCase extends AbstractTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/../Fixtures/SlugScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LinkGeneratorFreeModeTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LinkGeneratorFreeModeTest.php index 7f7ac53ff334..7c31ad0b3241 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LinkGeneratorFreeModeTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LinkGeneratorFreeModeTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; @@ -78,7 +78,7 @@ final class LinkGeneratorFreeModeTest extends AbstractTestCase function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/SlugScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); @@ -88,8 +88,8 @@ final class LinkGeneratorFreeModeTest extends AbstractTestCase $this->setUpFrontendRootPage(2000, ['EXT:frontend/Tests/Functional/SiteHandling/Fixtures/LinkGenerator.typoscript'], ['title' => 'ACME Blog']); }, function () { - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } ); } diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/AbstractLocalizedPagesTestCase.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/AbstractLocalizedPagesTestCase.php index 5cd3ed9ff54a..bed6bc58b841 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/AbstractLocalizedPagesTestCase.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/AbstractLocalizedPagesTestCase.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; @@ -37,7 +37,7 @@ abstract class AbstractLocalizedPagesTestCase extends AbstractTestCase $this->withDatabaseSnapshot(function () use ($pathToYamlFile) { $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $factory = DataHandlerFactory::fromYamlFile($pathToYamlFile); $writer = DataHandlerWriter::withBackendUser($backendUser); $writer->invokeFactory($factory); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/MountPointTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/MountPointTest.php index d0d55b7fe567..cc1dab194f30 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/MountPointTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/MountPointTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; @@ -103,7 +103,7 @@ final class MountPointTest extends AbstractTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/MountPointScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/RequestHandlerTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/RequestHandlerTest.php index 87c5d48286dd..855404aa4939 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/RequestHandlerTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/RequestHandlerTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\Cache\NonceValueSubstitution; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; @@ -40,7 +40,7 @@ final class RequestHandlerTest extends AbstractTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/SlugScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php index 62bc599dcf3f..725873737598 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\PermutationUtility; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; @@ -33,7 +33,7 @@ final class SiteRequestTest extends AbstractTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/PlainScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php index 9e0432527a07..eb017be3d938 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php @@ -18,8 +18,8 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Domain\Repository\PageRepository; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\TypoScriptInstruction; @@ -79,7 +79,7 @@ final class SlugLinkGeneratorTest extends AbstractTestCase function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/SlugScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); @@ -89,8 +89,8 @@ final class SlugLinkGeneratorTest extends AbstractTestCase $this->setUpFrontendRootPage(2000, ['EXT:frontend/Tests/Functional/SiteHandling/Fixtures/LinkGenerator.typoscript'], ['title' => 'ACME Blog']); }, function () { - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } ); } diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersDisabledTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersDisabledTest.php index 40bf912b9b4f..5b72ba1867eb 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersDisabledTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersDisabledTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; @@ -48,7 +48,7 @@ final class SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersDisabledT $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/SlugScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersEnabledTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersEnabledTest.php index 2112e57af0a6..c10252c11c4f 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersEnabledTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersEnabledTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; @@ -48,7 +48,7 @@ final class SlugSiteRequestAllowInsecureSiteResolutionByQueryParametersEnabledTe $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/SlugScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php index 0706c23402ee..a206be35cf6e 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\PermutationUtility; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; @@ -48,7 +48,7 @@ final class SlugSiteRequestTest extends AbstractTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/SlugScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteWithoutRequiredCHashRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteWithoutRequiredCHashRequestTest.php index f564bb61c638..383c44896324 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteWithoutRequiredCHashRequestTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteWithoutRequiredCHashRequestTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\PermutationUtility; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; @@ -45,7 +45,7 @@ final class SlugSiteWithoutRequiredCHashRequestTest extends AbstractTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/SlugScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/TypoLinkGeneratorTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/TypoLinkGeneratorTest.php index c38901b5bafa..aeecd33103ad 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/TypoLinkGeneratorTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/TypoLinkGeneratorTest.php @@ -18,8 +18,8 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling; use Psr\Http\Message\ResponseInterface; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Resource\Index\Indexer; use TYPO3\CMS\Core\Resource\StorageRepository; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -55,7 +55,7 @@ final class TypoLinkGeneratorTest extends AbstractTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $scenarioFile = __DIR__ . '/Fixtures/TypoLinkScenario.yaml'; $factory = DataHandlerFactory::fromYamlFile($scenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); diff --git a/typo3/sysext/impexp/Tests/Functional/AbstractImportExportTestCase.php b/typo3/sysext/impexp/Tests/Functional/AbstractImportExportTestCase.php index f340977b14e9..c2cbc17bfde2 100644 --- a/typo3/sysext/impexp/Tests/Functional/AbstractImportExportTestCase.php +++ b/typo3/sysext/impexp/Tests/Functional/AbstractImportExportTestCase.php @@ -19,10 +19,10 @@ namespace TYPO3\CMS\Impexp\Tests\Functional; use PHPUnit\Util\Xml\Loader as XmlLoader; use TYPO3\CMS\Backend\Routing\Route; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -46,7 +46,7 @@ abstract class AbstractImportExportTestCase extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/Fixtures/DatabaseImports/be_users.csv'); $backendUser = $this->setUpBackendUser(1); $backendUser->workspace = 0; - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest('https://www.example.com/')) ->withAttribute('route', new Route('/record/importexport/export', [])) diff --git a/typo3/sysext/linkvalidator/Tests/Functional/Repository/BrokenLinkRepositoryTest.php b/typo3/sysext/linkvalidator/Tests/Functional/Repository/BrokenLinkRepositoryTest.php index e928bc6b18e0..d3841e5581cd 100644 --- a/typo3/sysext/linkvalidator/Tests/Functional/Repository/BrokenLinkRepositoryTest.php +++ b/typo3/sysext/linkvalidator/Tests/Functional/Repository/BrokenLinkRepositoryTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Linkvalidator\Tests\Functional\Repository; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Linkvalidator\LinkAnalyzer; use TYPO3\CMS\Linkvalidator\Repository\BrokenLinkRepository; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -698,7 +698,7 @@ final class BrokenLinkRepositoryTest extends FunctionalTestCase $this->importCSVDataSet($groupFixtureFile); } $this->importCSVDataSet($fixtureFile); - $this->setUpBackendUser($uid); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser($uid); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } } diff --git a/typo3/sysext/recycler/Tests/Functional/Recycle/Pages/AdminRecycleTest.php b/typo3/sysext/recycler/Tests/Functional/Recycle/Pages/AdminRecycleTest.php index 88c37b5bef1a..8a62192f3a07 100644 --- a/typo3/sysext/recycler/Tests/Functional/Recycle/Pages/AdminRecycleTest.php +++ b/typo3/sysext/recycler/Tests/Functional/Recycle/Pages/AdminRecycleTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Recycler\Tests\Functional\Recycle\Pages; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Recycler\Tests\Functional\Recycle\AbstractRecycleTestCase; final class AdminRecycleTest extends AbstractRecycleTestCase @@ -29,8 +29,8 @@ final class AdminRecycleTest extends AbstractRecycleTestCase $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Database/be_groups.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Database/be_users.csv'); // Set up "admin" user - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/recycler/Tests/Functional/Recycle/Pages/UserRecycleTest.php b/typo3/sysext/recycler/Tests/Functional/Recycle/Pages/UserRecycleTest.php index c48660e66219..f3459072f625 100644 --- a/typo3/sysext/recycler/Tests/Functional/Recycle/Pages/UserRecycleTest.php +++ b/typo3/sysext/recycler/Tests/Functional/Recycle/Pages/UserRecycleTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Recycler\Tests\Functional\Recycle\Pages; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Recycler\Tests\Functional\Recycle\AbstractRecycleTestCase; final class UserRecycleTest extends AbstractRecycleTestCase @@ -29,8 +29,8 @@ final class UserRecycleTest extends AbstractRecycleTestCase $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Database/be_groups.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Database/be_users.csv'); // Set up "editor" user - $this->setUpBackendUser(2); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(2); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/redirects/Tests/Functional/Controller/ManagementControllerTest.php b/typo3/sysext/redirects/Tests/Functional/Controller/ManagementControllerTest.php index 01eb0c7acd1c..71e96c2bde15 100644 --- a/typo3/sysext/redirects/Tests/Functional/Controller/ManagementControllerTest.php +++ b/typo3/sysext/redirects/Tests/Functional/Controller/ManagementControllerTest.php @@ -19,11 +19,11 @@ namespace TYPO3\CMS\Redirects\Tests\Functional\Controller; use Symfony\Component\DependencyInjection\Container; use TYPO3\CMS\Backend\Routing\Route; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\EventDispatcher\ListenerProvider; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Redirects\Controller\ManagementController; use TYPO3\CMS\Redirects\Event\ModifyRedirectManagementControllerViewDataEvent; @@ -39,8 +39,8 @@ final class ManagementControllerTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->subject = GeneralUtility::makeInstance(ManagementController::class); $this->normalizedParams = new NormalizedParams([], [], '', ''); diff --git a/typo3/sysext/redirects/Tests/Functional/Service/SlugServiceTest.php b/typo3/sysext/redirects/Tests/Functional/Service/SlugServiceTest.php index 63d7092dcdb1..5106cace4ea2 100644 --- a/typo3/sysext/redirects/Tests/Functional/Service/SlugServiceTest.php +++ b/typo3/sysext/redirects/Tests/Functional/Service/SlugServiceTest.php @@ -22,11 +22,11 @@ use Psr\Log\NullLogger; use Symfony\Component\DependencyInjection\Container; use TYPO3\CMS\Core\Configuration\SiteConfiguration; use TYPO3\CMS\Core\Context\Context; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\DataHandling\Model\CorrelationId; use TYPO3\CMS\Core\Domain\Repository\PageRepository; use TYPO3\CMS\Core\EventDispatcher\ListenerProvider; use TYPO3\CMS\Core\LinkHandling\LinkService; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Routing\SiteMatcher; use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -93,8 +93,8 @@ final class SlugServiceTest extends FunctionalTestCase parent::setUp(); $this->correlationId = CorrelationId::forScope(StringUtility::getUniqueId('test')); $this->importCSVDataSet(__DIR__ . '/Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } protected function tearDown(): void diff --git a/typo3/sysext/rte_ckeditor/Tests/Functional/RecordList/Controller/BrowseLinksControllerTest.php b/typo3/sysext/rte_ckeditor/Tests/Functional/RecordList/Controller/BrowseLinksControllerTest.php index d15ff9742644..45b237d2c90e 100644 --- a/typo3/sysext/rte_ckeditor/Tests/Functional/RecordList/Controller/BrowseLinksControllerTest.php +++ b/typo3/sysext/rte_ckeditor/Tests/Functional/RecordList/Controller/BrowseLinksControllerTest.php @@ -21,11 +21,11 @@ use Symfony\Component\DependencyInjection\Container; use TYPO3\CMS\Backend\Controller\Event\ModifyAllowedItemsEvent; use TYPO3\CMS\Backend\Controller\Event\ModifyLinkHandlersEvent; use TYPO3\CMS\Backend\Routing\Route; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\EventDispatcher\ListenerProvider; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\RteCKEditor\Controller\BrowseLinksController; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -40,8 +40,8 @@ final class BrowseLinksControllerTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/seo/Tests/Functional/HrefLang/HrefLangGeneratorTest.php b/typo3/sysext/seo/Tests/Functional/HrefLang/HrefLangGeneratorTest.php index cd1b4c4cb69a..391fe268156f 100644 --- a/typo3/sysext/seo/Tests/Functional/HrefLang/HrefLangGeneratorTest.php +++ b/typo3/sysext/seo/Tests/Functional/HrefLang/HrefLangGeneratorTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Seo\Tests\Functional\HrefLang; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter; @@ -62,7 +62,7 @@ final class HrefLangGeneratorTest extends FunctionalTestCase $this->withDatabaseSnapshot(function () { $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $factory = DataHandlerFactory::fromYamlFile(__DIR__ . '/../Fixtures/HrefLangScenario.yml'); $writer = DataHandlerWriter::withBackendUser($backendUser); $writer->invokeFactory($factory); diff --git a/typo3/sysext/webhooks/Tests/Functional/WebhookExecutionTest.php b/typo3/sysext/webhooks/Tests/Functional/WebhookExecutionTest.php index cd0d614bda74..538a2a909e8e 100644 --- a/typo3/sysext/webhooks/Tests/Functional/WebhookExecutionTest.php +++ b/typo3/sysext/webhooks/Tests/Functional/WebhookExecutionTest.php @@ -21,11 +21,11 @@ use Psr\Http\Message\RequestInterface; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\SecurityAspect; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Http\ResponseFactory; use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Http\StreamFactory; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Security\RequestToken; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -56,8 +56,8 @@ final class WebhookExecutionTest extends FunctionalTestCase $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv'); $this->importCSVDataSet(__DIR__ . '/Fixtures/sys_webhooks.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); $this->writeSiteConfiguration( 'testing', diff --git a/typo3/sysext/workspaces/Tests/Functional/EventListener/PageTreeItemsHighlighterTest.php b/typo3/sysext/workspaces/Tests/Functional/EventListener/PageTreeItemsHighlighterTest.php index 294099ac357a..230fa0f6eeef 100644 --- a/typo3/sysext/workspaces/Tests/Functional/EventListener/PageTreeItemsHighlighterTest.php +++ b/typo3/sysext/workspaces/Tests/Functional/EventListener/PageTreeItemsHighlighterTest.php @@ -20,9 +20,9 @@ namespace TYPO3\CMS\Workspaces\Tests\Functional\EventListener; use TYPO3\CMS\Backend\Controller\Event\AfterPageTreeItemsPreparedEvent; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\WorkspaceAspect; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Http\Uri; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Workspaces\EventListener\PageTreeItemsHighlighter; use TYPO3\CMS\Workspaces\Service\WorkspaceService; @@ -36,8 +36,8 @@ final class PageTreeItemsHighlighterTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** diff --git a/typo3/sysext/workspaces/Tests/Functional/Hook/DataHandlerHookTest.php b/typo3/sysext/workspaces/Tests/Functional/Hook/DataHandlerHookTest.php index c9fbe9e565cc..35c586822945 100644 --- a/typo3/sysext/workspaces/Tests/Functional/Hook/DataHandlerHookTest.php +++ b/typo3/sysext/workspaces/Tests/Functional/Hook/DataHandlerHookTest.php @@ -21,8 +21,8 @@ use Symfony\Component\DependencyInjection\Container; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\WorkspaceAspect; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\EventDispatcher\ListenerProvider; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Workspaces\Event\AfterRecordPublishedEvent; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; @@ -43,7 +43,7 @@ final class DataHandlerHookTest extends FunctionalTestCase parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); $this->backendUser = $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($this->backendUser); $this->actionService = new ActionService(); $this->setWorkspaceId(0); } diff --git a/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php b/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php index ba273fd8b2ea..778a82d4d296 100644 --- a/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php +++ b/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php @@ -17,7 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Workspaces\Tests\Functional\Service; -use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Workspaces\Service\WorkspaceService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -32,9 +32,9 @@ final class WorkspaceServiceTest extends FunctionalTestCase { parent::setUp(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); - $this->setUpBackendUser(1); - Bootstrap::initializeLanguageObject(); $this->importCSVDataSet(__DIR__ . '/../Fixtures/sys_workspace.csv'); + $backendUser = $this->setUpBackendUser(1); + $GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser); } /** -- GitLab