[TASK] Inject singletons used by EXT:install in service providers
This will allow both, dependency injection for these services (manually wired in service providers), and usage in install/maintenance tool (where we do not use the caching symfony container for basic tasks). The move to DI is possible thanks to the failsafe container and the service providers which can fed the failsafe container with service factories. These factories are used to wire services manually. Notes: * The definition in a service provider means we are required to use manual wiring and are forced to define the dependencies in the service provider when we add new depenencies to services that are being used by the install.. With that approach we can assure that we do not accidentally add new dependencies to services which would become available in symfony DI due to autowiring, but would be unavailable in the install tool. * The install tool has operations that require a booted symfony container which is provided by the LateBootService. Services that are used in that mode do not need to be listed in service providers. Therefore we do only add core services to service providers if they are used in a context without a fully booted symfony DI container. * GLOBALS['LANG'] mocks in Core\Tests\Unit\DataHandling\DataHandlerTest have been removed as the code under test does no longer use $GLOBALS['LANG']->csConvObj->substr() but mb_substr. The test had been introduced with #68602 but the tested code was adapted in #78670. * We got a bit ugly constructs now, where a unit(!) test previously used $GLOBALS['LANG'] = new LanguageService(); …we now have to encode the dependency structure: $GLOBALS['LANG'] = new LanguageService(new Locales, new LocalizationFactory( new LanguageStore, $cacheManagerProphecy->reveal() ) ); This isn't nice, but this change reveals that the affected unit tests should either be adapted, removed or be moved to a functional test. Such adaption are out of scope for this change. * loadExtLocalconfDatabaseAndExtTables() is removed from the EXT:install AbstractController, as it hides the implicit dependency to LateBootService * Nullable constructor arguments have been changed to be non-nullable whenever possible. That results in some more test adaptions, but reveals, where unit tests rely on implicit dependencies and offers better readability and less possible codepaths. Releases: master Resolves: #89892 Resolves: #89891 Change-Id: Ib72d6440f81b2c0d05279e8768697c3b48aecfe4 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62575 Tested-by:TYPO3com <noreply@typo3.com> Tested-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Tested-by:
Susanne Moog <look@susi.dev> Reviewed-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by:
Susanne Moog <look@susi.dev>
Showing
- typo3/sysext/core/Classes/Imaging/IconFactory.php 3 additions, 3 deletionstypo3/sysext/core/Classes/Imaging/IconFactory.php
- typo3/sysext/core/Classes/Localization/LanguageService.php 18 additions, 12 deletionstypo3/sysext/core/Classes/Localization/LanguageService.php
- typo3/sysext/core/Classes/Localization/LanguageServiceFactory.php 53 additions, 0 deletions...sext/core/Classes/Localization/LanguageServiceFactory.php
- typo3/sysext/core/Classes/Localization/LocalizationFactory.php 3 additions, 14 deletions.../sysext/core/Classes/Localization/LocalizationFactory.php
- typo3/sysext/core/Classes/ServiceProvider.php 161 additions, 13 deletionstypo3/sysext/core/Classes/ServiceProvider.php
- typo3/sysext/core/Configuration/Services.yaml 9 additions, 3 deletionstypo3/sysext/core/Configuration/Services.yaml
- typo3/sysext/core/Tests/Functional/Database/QueryGeneratorTest.php 1 addition, 1 deletion...ext/core/Tests/Functional/Database/QueryGeneratorTest.php
- typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php 0 additions, 2 deletions...3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
- typo3/sysext/core/Tests/Unit/Error/ProductionExceptionHandlerTest.php 10 additions, 0 deletions.../core/Tests/Unit/Error/ProductionExceptionHandlerTest.php
- typo3/sysext/core/Tests/Unit/Imaging/IconTest.php 2 additions, 1 deletiontypo3/sysext/core/Tests/Unit/Imaging/IconTest.php
- typo3/sysext/core/Tests/Unit/Localization/LocalizationFactoryTest.php 5 additions, 14 deletions.../core/Tests/Unit/Localization/LocalizationFactoryTest.php
- typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php 11 additions, 15 deletions...t/core/Tests/Unit/Localization/Parser/XliffParserTest.php
- typo3/sysext/core/Tests/Unit/Utility/File/ExtendedFileUtilityTest.php 1 addition, 0 deletions.../core/Tests/Unit/Utility/File/ExtendedFileUtilityTest.php
- typo3/sysext/core/Tests/UnitDeprecated/Localization/LocalizationFactoryTest.php 2 additions, 4 deletions...s/UnitDeprecated/Localization/LocalizationFactoryTest.php
- typo3/sysext/core/Tests/UnitDeprecated/Localization/Parser/LocallangXmlParserTest.php 9 additions, 5 deletions...Deprecated/Localization/Parser/LocallangXmlParserTest.php
- typo3/sysext/extbase/Classes/ServiceProvider.php 11 additions, 0 deletionstypo3/sysext/extbase/Classes/ServiceProvider.php
- typo3/sysext/extbase/Tests/Functional/Mvc/Validation/ActionControllerValidationTest.php 2 additions, 2 deletions...ctional/Mvc/Validation/ActionControllerValidationTest.php
- typo3/sysext/extbase/Tests/Unit/Utility/LocalizationUtilityTest.php 22 additions, 3 deletions...xt/extbase/Tests/Unit/Utility/LocalizationUtilityTest.php
- typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php 1 addition, 1 deletion...ionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php
- typo3/sysext/form/Tests/Unit/Service/TranslationServiceTest.php 3 additions, 1 deletion...sysext/form/Tests/Unit/Service/TranslationServiceTest.php
Please register or sign in to comment