• Benjamin Franzke's avatar
    [TASK] Inject singletons used by EXT:install in service providers · c020e9ba
    Benjamin Franzke authored and Susanne Moog's avatar Susanne Moog committed
    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: default avatarTYPO3com <noreply@typo3.com>
    Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
    Tested-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
    Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
    Reviewed-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
    c020e9ba