From 73ebbf8ff08798b61f5cde27c97e9fc5f5f2bed4 Mon Sep 17 00:00:00 2001 From: Helmut Hummel <helmut.hummel@typo3.org> Date: Wed, 7 Oct 2015 23:26:12 +0200 Subject: [PATCH] [BUGFIX] Fix regeneration of autoload files in testing context 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 | 4 ++-- .../core/Classes/Core/ClassLoadingInformation.php | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index 7ccaf988a7e8..3bbaacb117e5 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -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(); } diff --git a/typo3/sysext/core/Classes/Core/ClassLoadingInformation.php b/typo3/sysext/core/Classes/Core/ClassLoadingInformation.php index 768dd9deed8c..8ff5c38de7b9 100644 --- a/typo3/sysext/core/Classes/Core/ClassLoadingInformation.php +++ b/typo3/sysext/core/Classes/Core/ClassLoadingInformation.php @@ -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); } } -- GitLab