[BUGFIX] Fix regeneration of autoload files in testing context 04/43904/4
authorHelmut Hummel <helmut.hummel@typo3.org>
Wed, 7 Oct 2015 21:26:12 +0000 (23:26 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 8 Oct 2015 10:42:04 +0000 (12:42 +0200)
In testing context and in non composer mode, the additional class loading
information should be regenerated for each test run.

The code for that never worked and is now fixed with this change.

Resolves: #70482
Releases: master
Change-Id: Ia8e23d9c4409e6e5ce17c6520458913634888913
Reviewed-on: http://review.typo3.org/43904
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/ClassLoadingInformation.php

index 7ccaf98..3bbaacb 100644 (file)
@@ -182,7 +182,7 @@ class Bootstrap {
         */
        public function baseSetup($relativePathPart = '') {
                SystemEnvironmentBuilder::run($relativePathPart);
-               if (!self::$usesComposerClassLoading) {
+               if (!self::$usesComposerClassLoading && ClassLoadingInformation::isClassLoadingInformationAvailable()) {
                        ClassLoadingInformation::registerClassLoadingInformation();
                }
                GeneralUtility::presetApplicationContext($this->applicationContext);
@@ -414,7 +414,7 @@ class Bootstrap {
         * @internal This is not a public API method, do not use in own extensions
         */
        public function ensureClassLoadingInformationExists() {
-               if (!self::$usesComposerClassLoading && !ClassLoadingInformation::classLoadingInformationExists()) {
+               if (!self::$usesComposerClassLoading && !ClassLoadingInformation::isClassLoadingInformationAvailable()) {
                        ClassLoadingInformation::dumpClassLoadingInformation();
                        ClassLoadingInformation::registerClassLoadingInformation();
                }
index 768dd9d..8ff5c38 100644 (file)
@@ -56,13 +56,13 @@ class ClassLoadingInformation {
        const AUTOLOAD_CLASSALIASMAP_FILENAME = 'autoload_classaliasmap.php';
 
        /**
-        * Checks if the autoload_classmap.php exists. Used to see if the ClassLoadingInformationGenerator
-        * should be called.
+        * Checks if the autoload_classmap.php exists and we are not in testing context.
+        * Used to see if the ClassLoadingInformationGenerator should be called.
         *
         * @return bool
         */
-       static public function classLoadingInformationExists() {
-               return file_exists(self::getClassLoadingInformationDirectory() . self::AUTOLOAD_CLASSMAP_FILENAME);
+       static public function isClassLoadingInformationAvailable() {
+               return !self::isTestingContext() && file_exists(self::getClassLoadingInformationDirectory() . self::AUTOLOAD_CLASSMAP_FILENAME);
        }
 
        /**
@@ -170,8 +170,6 @@ class ClassLoadingInformation {
                $autoloadInfoDir = self::getClassLoadingInformationDirectory();
                if (!file_exists($autoloadInfoDir)) {
                        GeneralUtility::mkdir_deep($autoloadInfoDir);
-               } elseif (self::isTestingContext()) {
-                       GeneralUtility::flushDirectory($autoloadInfoDir, TRUE);
                }
        }