From c97a10abdd23b13192afcc5c903036cdb24ba158 Mon Sep 17 00:00:00 2001
From: Oliver Bartsch <bo@cedev.de>
Date: Fri, 23 Feb 2024 10:38:38 +0100
Subject: [PATCH] [TASK] Ensure using symfony container in tests

A couple of tests are adding services to a
container instance. Since the `ContainerInterface`
does not define the used `set()` method, the
tests are adjusted to explicitly require the
symfony service container, which provides
mentioned `set()` method.

Resolves: #103183
Releases: main, 12.4
Change-Id: Icdb36a0ea871d79cd2c280d5f17a00569b49cb2b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83084
Tested-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: Andreas Kienast <a.fernandez@scripting-base.de>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
---
 Build/phpstan/phpstan-baseline.neon                    | 10 ----------
 .../Functional/Controller/BackendControllerTest.php    |  2 +-
 .../Functional/Controller/Page/TreeControllerTest.php  |  2 +-
 .../Configuration/FlexForm/FlexFormToolsTest.php       | 10 +++++-----
 .../Domain/Repository/PageRepositoryTest.php           |  4 ++--
 .../core/Tests/Functional/Imaging/IconFactoryTest.php  |  2 +-
 typo3/sysext/core/Tests/Functional/Mail/MailerTest.php |  2 +-
 .../Package/Event/PackageInitializationEventTest.php   |  2 +-
 .../Resource/DefaultUploadFolderResolverTest.php       |  4 ++--
 .../OnlineMedia/Processing/PreviewProcessingTest.php   |  2 +-
 .../dashboard/Tests/Functional/WidgetRegistryTest.php  |  2 +-
 .../Configuration/FrontendConfigurationManagerTest.php |  2 +-
 .../Validation/Validator/CollectionValidatorTest.php   |  4 ++--
 .../ViewHelpers/Form/SelectViewHelperTest.php          |  8 ++++----
 .../ContentObject/ContentContentObjectTest.php         |  2 +-
 .../ContentObject/ContentObjectRendererTest.php        |  8 ++++----
 .../ViewHelpers/Format/PhpErrorCodeViewHelperTest.php  |  2 +-
 .../GlobalVariableProviderTest.php                     |  2 +-
 .../Functional/Controller/ManagementControllerTest.php |  2 +-
 .../EventListener/AddPageTypeZeroSourceTest.php        |  2 +-
 .../AddPlainSlugReplacementSourceTest.php              |  2 +-
 .../SlugRedirectChangeItemFactoryTest.php              |  2 +-
 .../Tests/Functional/Service/RedirectServiceTest.php   |  2 +-
 .../Tests/Functional/Service/SlugServiceTest.php       |  4 ++--
 .../Controller/BrowseLinksControllerTest.php           |  2 +-
 .../Functional/Canonical/CanonicalGeneratorTest.php    |  2 +-
 .../Tests/Functional/Hook/DataHandlerHookTest.php      |  2 +-
 27 files changed, 40 insertions(+), 50 deletions(-)

diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon
index 1290d950fed7..98b07c6fb9ad 100644
--- a/Build/phpstan/phpstan-baseline.neon
+++ b/Build/phpstan/phpstan-baseline.neon
@@ -1475,11 +1475,6 @@ parameters:
 			count: 1
 			path: ../../typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php
 
-		-
-			message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:set\\(\\)\\.$#"
-			count: 4
-			path: ../../typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/SelectViewHelperTest.php
-
 		-
 			message: "#^Parameter \\#1 \\$input of method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\ResourceFactory\\:\\:retrieveFileOrFolderObject\\(\\) expects string, int given\\.$#"
 			count: 1
@@ -2110,11 +2105,6 @@ parameters:
 			count: 1
 			path: ../../typo3/sysext/install/Classes/Updates/DatabaseRowsUpdateWizard.php
 
-		-
-			message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:set\\(\\)\\.$#"
-			count: 1
-			path: ../../typo3/sysext/install/Tests/Functional/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php
-
 		-
 			message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with array\\{string, string, string\\} and array\\<TYPO3\\\\CMS\\\\Core\\\\Messaging\\\\FlashMessage\\> will always evaluate to false\\.$#"
 			count: 1
diff --git a/typo3/sysext/backend/Tests/Functional/Controller/BackendControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/BackendControllerTest.php
index c198a7aac6d0..981b3c3b0faa 100644
--- a/typo3/sysext/backend/Tests/Functional/Controller/BackendControllerTest.php
+++ b/typo3/sysext/backend/Tests/Functional/Controller/BackendControllerTest.php
@@ -50,7 +50,7 @@ final class BackendControllerTest extends FunctionalTestCase
     public function backendPageRenderEventIsTriggered(): void
     {
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
 
         $state = [
             'after-backend-page-render-listener' => null,
diff --git a/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php
index c2b99300c41c..6800b9b76301 100644
--- a/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php
+++ b/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php
@@ -715,7 +715,7 @@ final class TreeControllerTest extends FunctionalTestCase
         $afterPageTreeItemsPreparedEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'after-page-tree-items-prepared-listener',
             static function (AfterPageTreeItemsPreparedEvent $event) use (&$afterPageTreeItemsPreparedEvent) {
diff --git a/typo3/sysext/core/Tests/Functional/Configuration/FlexForm/FlexFormToolsTest.php b/typo3/sysext/core/Tests/Functional/Configuration/FlexForm/FlexFormToolsTest.php
index ab238418e551..81eb79b3a4cc 100644
--- a/typo3/sysext/core/Tests/Functional/Configuration/FlexForm/FlexFormToolsTest.php
+++ b/typo3/sysext/core/Tests/Functional/Configuration/FlexForm/FlexFormToolsTest.php
@@ -62,7 +62,7 @@ final class FlexFormToolsTest extends FunctionalTestCase
             ],
         ];
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'noop',
             static function (BeforeFlexFormDataStructureIdentifierInitializedEvent $event) {
@@ -82,7 +82,7 @@ final class FlexFormToolsTest extends FunctionalTestCase
     public function getDataStructureIdentifierWithListenerReturnsThatListenersValue(): void
     {
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'identifier-one',
             static function (BeforeFlexFormDataStructureIdentifierInitializedEvent $event) {
@@ -105,7 +105,7 @@ final class FlexFormToolsTest extends FunctionalTestCase
     public function getDataStructureIdentifierWithModifyListenerCallsListener(): void
     {
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'modifier-one',
             static function (AfterFlexFormDataStructureIdentifierInitializedEvent $event) {
@@ -480,7 +480,7 @@ final class FlexFormToolsTest extends FunctionalTestCase
     public function parseDataStructureByIdentifierParsesDataStructureReturnedByEvent(): void
     {
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'string',
             static function (BeforeFlexFormDataStructureParsedEvent $event) {
@@ -755,7 +755,7 @@ final class FlexFormToolsTest extends FunctionalTestCase
         ';
         $identifier = '{"type":"tca","tableName":"aTableName","fieldName":"aFieldName","dataStructureKey":"default"}';
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'mock',
             static function (AfterFlexFormDataStructureParsedEvent $event) {
diff --git a/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php b/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php
index 72811185aef1..6cbfd72f2c66 100644
--- a/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php
+++ b/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php
@@ -646,7 +646,7 @@ final class PageRepositoryTest extends FunctionalTestCase
         $defaultConstraint = new CompositeExpression('foo');
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'modify-default-constraints-for-database-query-listener',
             static function (ModifyDefaultConstraintsForDatabaseQueryEvent $event) use (&$modifyDefaultConstraintsForDatabaseQueryEvent, $defaultConstraint) {
@@ -679,7 +679,7 @@ final class PageRepositoryTest extends FunctionalTestCase
         $beforePageIsRetrievedEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'before-page-is-retrieved-listener',
             static function (BeforePageIsRetrievedEvent $event) use (&$beforePageIsRetrievedEvent, $page, $pageId) {
diff --git a/typo3/sysext/core/Tests/Functional/Imaging/IconFactoryTest.php b/typo3/sysext/core/Tests/Functional/Imaging/IconFactoryTest.php
index ad8b978bbf50..e36039f5c7db 100644
--- a/typo3/sysext/core/Tests/Functional/Imaging/IconFactoryTest.php
+++ b/typo3/sysext/core/Tests/Functional/Imaging/IconFactoryTest.php
@@ -622,7 +622,7 @@ final class IconFactoryTest extends FunctionalTestCase
         $modifyRecordOverlayIconIdentifierEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'modify-record-overlay-icon-identifier-event-listener',
             static function (ModifyRecordOverlayIconIdentifierEvent $event) use (&$modifyRecordOverlayIconIdentifierEvent) {
diff --git a/typo3/sysext/core/Tests/Functional/Mail/MailerTest.php b/typo3/sysext/core/Tests/Functional/Mail/MailerTest.php
index 1bee83e36c98..8677f6fbc0df 100644
--- a/typo3/sysext/core/Tests/Functional/Mail/MailerTest.php
+++ b/typo3/sysext/core/Tests/Functional/Mail/MailerTest.php
@@ -42,7 +42,7 @@ final class MailerTest extends FunctionalTestCase
         $afterMailerSentMessageEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'after-mailer-initialized-listener',
             static function (AfterMailerInitializationEvent $event) use (&$afterMailerInitializedEvent) {
diff --git a/typo3/sysext/core/Tests/Functional/Package/Event/PackageInitializationEventTest.php b/typo3/sysext/core/Tests/Functional/Package/Event/PackageInitializationEventTest.php
index 6377b7ee138d..866d52d85013 100644
--- a/typo3/sysext/core/Tests/Functional/Package/Event/PackageInitializationEventTest.php
+++ b/typo3/sysext/core/Tests/Functional/Package/Event/PackageInitializationEventTest.php
@@ -141,7 +141,7 @@ final class PackageInitializationEventTest extends FunctionalTestCase
         $listenerResult = ['foo' => 'bar'];
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'package-initialization-listener',
             static function (PackageInitializationEvent $event) use (&$packageInitializationEvent, $listenerResult) {
diff --git a/typo3/sysext/core/Tests/Functional/Resource/DefaultUploadFolderResolverTest.php b/typo3/sysext/core/Tests/Functional/Resource/DefaultUploadFolderResolverTest.php
index 37069864bb2c..733ea18b44a6 100644
--- a/typo3/sysext/core/Tests/Functional/Resource/DefaultUploadFolderResolverTest.php
+++ b/typo3/sysext/core/Tests/Functional/Resource/DefaultUploadFolderResolverTest.php
@@ -157,7 +157,7 @@ final class DefaultUploadFolderResolverTest extends FunctionalTestCase
         $subject = GeneralUtility::makeInstance(DefaultUploadFolderResolver::class);
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'after-default-upload-folder-was-resolved-listener',
             static function (AfterDefaultUploadFolderWasResolvedEvent $event) use (&$afterDefaultUploadFolderWasResolvedEvent) {
@@ -183,7 +183,7 @@ final class DefaultUploadFolderResolverTest extends FunctionalTestCase
         $subject = GeneralUtility::makeInstance(DefaultUploadFolderResolver::class);
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'after-default-upload-folder-was-resolved-listener',
             static function (AfterDefaultUploadFolderWasResolvedEvent $event) {
diff --git a/typo3/sysext/core/Tests/Functional/Resource/OnlineMedia/Processing/PreviewProcessingTest.php b/typo3/sysext/core/Tests/Functional/Resource/OnlineMedia/Processing/PreviewProcessingTest.php
index e029e0231241..07dacd7dbc26 100644
--- a/typo3/sysext/core/Tests/Functional/Resource/OnlineMedia/Processing/PreviewProcessingTest.php
+++ b/typo3/sysext/core/Tests/Functional/Resource/OnlineMedia/Processing/PreviewProcessingTest.php
@@ -45,7 +45,7 @@ final class PreviewProcessingTest extends FunctionalTestCase
         $onlineMediaId = '2004';
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             $afterVideoPreviewFetchedEventListener,
             static function (AfterVideoPreviewFetchedEvent $event) use (
diff --git a/typo3/sysext/dashboard/Tests/Functional/WidgetRegistryTest.php b/typo3/sysext/dashboard/Tests/Functional/WidgetRegistryTest.php
index 788d8d921b51..45e30a5ce168 100644
--- a/typo3/sysext/dashboard/Tests/Functional/WidgetRegistryTest.php
+++ b/typo3/sysext/dashboard/Tests/Functional/WidgetRegistryTest.php
@@ -38,7 +38,7 @@ final class WidgetRegistryTest extends FunctionalTestCase
     protected function registerWidgets(): void
     {
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
 
         $this->subject = new WidgetRegistry($container);
 
diff --git a/typo3/sysext/extbase/Tests/Functional/Configuration/FrontendConfigurationManagerTest.php b/typo3/sysext/extbase/Tests/Functional/Configuration/FrontendConfigurationManagerTest.php
index 6ad96bf363c3..97b625245188 100644
--- a/typo3/sysext/extbase/Tests/Functional/Configuration/FrontendConfigurationManagerTest.php
+++ b/typo3/sysext/extbase/Tests/Functional/Configuration/FrontendConfigurationManagerTest.php
@@ -61,7 +61,7 @@ final class FrontendConfigurationManagerTest extends FunctionalTestCase
         $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())->withAttribute('frontend.typoscript', $frontendTypoScript);
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set('foo-flexform-listener', static function (BeforeFlexFormConfigurationOverrideEvent $event) {
             $event->setFlexFormConfiguration([
                 'settings' => [
diff --git a/typo3/sysext/extbase/Tests/Functional/Validation/Validator/CollectionValidatorTest.php b/typo3/sysext/extbase/Tests/Functional/Validation/Validator/CollectionValidatorTest.php
index 7c4ea30bf5b2..59506a2d278f 100644
--- a/typo3/sysext/extbase/Tests/Functional/Validation/Validator/CollectionValidatorTest.php
+++ b/typo3/sysext/extbase/Tests/Functional/Validation/Validator/CollectionValidatorTest.php
@@ -73,9 +73,9 @@ final class CollectionValidatorTest extends FunctionalTestCase
             [$this->get(ReflectionService::class)]
         );
         /** @var ContainerBuilder $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(ValidatorResolver::class, $mockValidatorResolver);
-        $subject = $this->get(CollectionValidator::class);
+        $subject = $container->get(CollectionValidator::class);
         $subject->setOptions(['elementValidator' => 'EmailAddress']);
         $emailAddressValidator = new EmailAddressValidator();
         $emailAddressValidator->setOptions([]);
diff --git a/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/SelectViewHelperTest.php b/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/SelectViewHelperTest.php
index 99e7b6e70c91..f35bccff6342 100644
--- a/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/SelectViewHelperTest.php
+++ b/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/SelectViewHelperTest.php
@@ -429,7 +429,7 @@ EOT;
                 return (string)$object->getId();
             }
         );
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(PersistenceManager::class, $mockPersistenceManager);
 
         $context = $container->get(RenderingContextFactory::class)->create();
@@ -461,7 +461,7 @@ EOT;
         // Mock persistence manager for our domain objects and set into container
         $mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
         $mockPersistenceManager->method('getIdentifierByObject')->willReturn('fakeUid');
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(PersistenceManager::class, $mockPersistenceManager);
 
         $context = $container->get(RenderingContextFactory::class)->create();
@@ -490,7 +490,7 @@ EOT;
         // Mock persistence manager for our domain objects and set into container
         $mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
         $mockPersistenceManager->method('getIdentifierByObject')->willReturn('fakeUid');
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(PersistenceManager::class, $mockPersistenceManager);
 
         $context = $container->get(RenderingContextFactory::class)->create();
@@ -519,7 +519,7 @@ EOT;
         // Mock persistence manager for our domain objects and set into container
         $mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
         $mockPersistenceManager->method('getIdentifierByObject')->willReturn(null);
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(PersistenceManager::class, $mockPersistenceManager);
 
         $context = $container->get(RenderingContextFactory::class)->create();
diff --git a/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentContentObjectTest.php b/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentContentObjectTest.php
index 4d18e4ff92f1..634379abdc1e 100644
--- a/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentContentObjectTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentContentObjectTest.php
@@ -39,7 +39,7 @@ final class ContentContentObjectTest extends FunctionalTestCase
         $modifyRecordsAfterFetchingContentEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'modify-records-after-fetching-content-listener',
             static function (ModifyRecordsAfterFetchingContentEvent $event) use (&$modifyRecordsAfterFetchingContentEvent, $records, $finalContent) {
diff --git a/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php
index 1926e0df0698..e3d60fbe688c 100644
--- a/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php
@@ -1266,7 +1266,7 @@ And another one';
         $afterContentObjectRendererInitializedEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'after-content-object-renderer-initialized-listener',
             static function (AfterContentObjectRendererInitializedEvent $event) use (&$afterContentObjectRendererInitializedEvent) {
@@ -1306,7 +1306,7 @@ And another one';
         $afterGetDataResolvedEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'after-get-data-resolved-listener',
             static function (AfterGetDataResolvedEvent $event) use (&$afterGetDataResolvedEvent) {
@@ -1337,7 +1337,7 @@ And another one';
         $afterImageResourceResolvedEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'after-image-resource-resolved-listener',
             static function (AfterImageResourceResolvedEvent $event) use (&$afterImageResourceResolvedEvent) {
@@ -1370,7 +1370,7 @@ And another one';
         $enhanceStdWrapEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'enhance-stdWrap-listener',
             static function (EnhanceStdWrapEvent $event) use (&$enhanceStdWrapEvent, $content) {
diff --git a/typo3/sysext/install/Tests/Functional/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php b/typo3/sysext/install/Tests/Functional/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php
index e01ce15d5809..7acc1776eca1 100644
--- a/typo3/sysext/install/Tests/Functional/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php
+++ b/typo3/sysext/install/Tests/Functional/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php
@@ -61,7 +61,7 @@ final class PhpErrorCodeViewHelperTest extends FunctionalTestCase
         // of ext:install VH's in container. To circumvent this conflict, we for now
         // instantiate our VH SuT and container->set() it to force service resolving.
         $viewHelperInstance = new PhpErrorCodeViewHelper();
-        $this->getContainer()->set(PhpErrorCodeViewHelper::class, $viewHelperInstance);
+        $this->get('service_container')->set(PhpErrorCodeViewHelper::class, $viewHelperInstance);
 
         $context = $this->get(RenderingContextFactory::class)->create();
         $context->getViewHelperResolver()->addNamespace('install', 'TYPO3\\CMS\\Install\\ViewHelpers');
diff --git a/typo3/sysext/lowlevel/Tests/Functional/ConfigurationModuleProvider/GlobalVariableProviderTest.php b/typo3/sysext/lowlevel/Tests/Functional/ConfigurationModuleProvider/GlobalVariableProviderTest.php
index e3188dcd9613..92dca91aba8a 100644
--- a/typo3/sysext/lowlevel/Tests/Functional/ConfigurationModuleProvider/GlobalVariableProviderTest.php
+++ b/typo3/sysext/lowlevel/Tests/Functional/ConfigurationModuleProvider/GlobalVariableProviderTest.php
@@ -40,7 +40,7 @@ final class GlobalVariableProviderTest extends FunctionalTestCase
         $modifiedBlindedConfigurationOptions = [$globalVariableKey => $blindedConfiguration];
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'modify-blinded-configuration-options',
             static function (ModifyBlindedConfigurationOptionsEvent $event) use (
diff --git a/typo3/sysext/redirects/Tests/Functional/Controller/ManagementControllerTest.php b/typo3/sysext/redirects/Tests/Functional/Controller/ManagementControllerTest.php
index 71e96c2bde15..cc7858ab78c8 100644
--- a/typo3/sysext/redirects/Tests/Functional/Controller/ManagementControllerTest.php
+++ b/typo3/sysext/redirects/Tests/Functional/Controller/ManagementControllerTest.php
@@ -61,7 +61,7 @@ final class ManagementControllerTest extends FunctionalTestCase
         $setHosts = ['*', 'example.com'];
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'modify-redirect-management-controller-view-data-event',
             static function (ModifyRedirectManagementControllerViewDataEvent $event) use (
diff --git a/typo3/sysext/redirects/Tests/Functional/EventListener/AddPageTypeZeroSourceTest.php b/typo3/sysext/redirects/Tests/Functional/EventListener/AddPageTypeZeroSourceTest.php
index 8c1084c4c2f2..9ed4c2dc8683 100644
--- a/typo3/sysext/redirects/Tests/Functional/EventListener/AddPageTypeZeroSourceTest.php
+++ b/typo3/sysext/redirects/Tests/Functional/EventListener/AddPageTypeZeroSourceTest.php
@@ -154,7 +154,7 @@ final class AddPageTypeZeroSourceTest extends FunctionalTestCase
         $siteLanguage = $site->getDefaultLanguage();
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'add-custom-page-type-source',
             static function (SlugRedirectChangeItemCreatedEvent $event) {
diff --git a/typo3/sysext/redirects/Tests/Functional/EventListener/AddPlainSlugReplacementSourceTest.php b/typo3/sysext/redirects/Tests/Functional/EventListener/AddPlainSlugReplacementSourceTest.php
index 40ec91542012..c2cbc58194ce 100644
--- a/typo3/sysext/redirects/Tests/Functional/EventListener/AddPlainSlugReplacementSourceTest.php
+++ b/typo3/sysext/redirects/Tests/Functional/EventListener/AddPlainSlugReplacementSourceTest.php
@@ -45,7 +45,7 @@ final class AddPlainSlugReplacementSourceTest extends FunctionalTestCase
 
         // Removing AddPageTypeZeroSource event is needed to avoid cross dependency here for this test.
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             AddPageTypeZeroSource::class,
             static function (SlugRedirectChangeItemCreatedEvent $event) {}
diff --git a/typo3/sysext/redirects/Tests/Functional/RedirectUpdate/SlugRedirectChangeItemFactoryTest.php b/typo3/sysext/redirects/Tests/Functional/RedirectUpdate/SlugRedirectChangeItemFactoryTest.php
index 2be8cbad815d..93a951bc7337 100644
--- a/typo3/sysext/redirects/Tests/Functional/RedirectUpdate/SlugRedirectChangeItemFactoryTest.php
+++ b/typo3/sysext/redirects/Tests/Functional/RedirectUpdate/SlugRedirectChangeItemFactoryTest.php
@@ -118,7 +118,7 @@ final class SlugRedirectChangeItemFactoryTest extends FunctionalTestCase
         ]);
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'slug-redirect-change-item-created',
             static function (SlugRedirectChangeItemCreatedEvent $event) use (
diff --git a/typo3/sysext/redirects/Tests/Functional/Service/RedirectServiceTest.php b/typo3/sysext/redirects/Tests/Functional/Service/RedirectServiceTest.php
index dbc6b1f7eb64..f7ffcf738489 100644
--- a/typo3/sysext/redirects/Tests/Functional/Service/RedirectServiceTest.php
+++ b/typo3/sysext/redirects/Tests/Functional/Service/RedirectServiceTest.php
@@ -874,7 +874,7 @@ final class RedirectServiceTest extends FunctionalTestCase
 
         $dispatchedEvents = [];
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'before-redirect-match-domain-event-is-triggered',
             static function (BeforeRedirectMatchDomainEvent $event) use (
diff --git a/typo3/sysext/redirects/Tests/Functional/Service/SlugServiceTest.php b/typo3/sysext/redirects/Tests/Functional/Service/SlugServiceTest.php
index 497ff9631c6f..44e7b6173cdd 100644
--- a/typo3/sysext/redirects/Tests/Functional/Service/SlugServiceTest.php
+++ b/typo3/sysext/redirects/Tests/Functional/Service/SlugServiceTest.php
@@ -419,7 +419,7 @@ final class SlugServiceTest extends FunctionalTestCase
         $this->importCSVDataSet(__DIR__ . '/Fixtures/SlugServiceTest_ModifyAutoCreateRedirectRecordBeforePersistingEvent.csv');
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'modify-auto-create-redirect-record-before-persisting',
             static function (ModifyAutoCreateRedirectRecordBeforePersistingEvent $event) use (
@@ -471,7 +471,7 @@ final class SlugServiceTest extends FunctionalTestCase
         $this->importCSVDataSet(__DIR__ . '/Fixtures/SlugServiceTest_AfterAutoCreateRedirectHasBeenPersistedEvent.csv');
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'after-auto-create-redirect-has-been-persisted',
             static function (AfterAutoCreateRedirectHasBeenPersistedEvent $event) use (
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 45b237d2c90e..9d7659a7752a 100644
--- a/typo3/sysext/rte_ckeditor/Tests/Functional/RecordList/Controller/BrowseLinksControllerTest.php
+++ b/typo3/sysext/rte_ckeditor/Tests/Functional/RecordList/Controller/BrowseLinksControllerTest.php
@@ -50,7 +50,7 @@ final class BrowseLinksControllerTest extends FunctionalTestCase
     public function linkEventsAreTriggered(): void
     {
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
 
         $state = [
             'modify-link-handl-listener' => null,
diff --git a/typo3/sysext/seo/Tests/Functional/Canonical/CanonicalGeneratorTest.php b/typo3/sysext/seo/Tests/Functional/Canonical/CanonicalGeneratorTest.php
index c0afda32bc37..fc48a6a7fd0c 100644
--- a/typo3/sysext/seo/Tests/Functional/Canonical/CanonicalGeneratorTest.php
+++ b/typo3/sysext/seo/Tests/Functional/Canonical/CanonicalGeneratorTest.php
@@ -159,7 +159,7 @@ final class CanonicalGeneratorTest extends FunctionalTestCase
         $modifyUrlForCanonicalTagEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'modify-url-for-canonical-tag-listener',
             static function (ModifyUrlForCanonicalTagEvent $event) use (&$modifyUrlForCanonicalTagEvent) {
diff --git a/typo3/sysext/workspaces/Tests/Functional/Hook/DataHandlerHookTest.php b/typo3/sysext/workspaces/Tests/Functional/Hook/DataHandlerHookTest.php
index 35c586822945..fbd31b6aa069 100644
--- a/typo3/sysext/workspaces/Tests/Functional/Hook/DataHandlerHookTest.php
+++ b/typo3/sysext/workspaces/Tests/Functional/Hook/DataHandlerHookTest.php
@@ -96,7 +96,7 @@ final class DataHandlerHookTest extends FunctionalTestCase
         $afterRecordPublishedEvent = null;
 
         /** @var Container $container */
-        $container = $this->getContainer();
+        $container = $this->get('service_container');
         $container->set(
             'after-record-published-event',
             static function (AfterRecordPublishedEvent $event) use (&$afterRecordPublishedEvent) {
-- 
GitLab