From e0c5ac1e5907a4ccb30fb1f43f8682f88e777cb3 Mon Sep 17 00:00:00 2001 From: Christian Kuhn Date: Sat, 1 Sep 2018 15:04:44 +0200 Subject: [PATCH] [BUGFIX] Do not remove LocalConfiguration if executing unit tests Unit test and code for #84623 relies on constants PATH_typo3conf and then removes LocalConfiguration and some other config files if the test is executed. Since that can't be mocked, the test is removed to prevent that side effect. Resolves: #86072 Related: #84623 Releases: master Change-Id: I3cd9a913e2655e6fcd1209fcfd8365cbcbb4a9ef Reviewed-on: https://review.typo3.org/58113 Reviewed-by: Richard Haeser Tested-by: Richard Haeser Tested-by: TYPO3com Reviewed-by: Anja Leichsenring Tested-by: Anja Leichsenring --- .../SilentConfigurationUpgradeServiceTest.php | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php index f4fd0f0359ab..34cfe34a29af 100644 --- a/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php @@ -18,8 +18,6 @@ use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use TYPO3\CMS\Core\Configuration\ConfigurationManager; -use TYPO3\CMS\Core\Core\ApplicationContext; -use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Crypto\PasswordHashing\Argon2iPasswordHash; use TYPO3\CMS\Core\Crypto\PasswordHashing\BcryptPasswordHash; use TYPO3\CMS\Core\Package\PackageManager; @@ -46,12 +44,6 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase */ protected $backupPackageManager; - /** - * restore Environment after each test - * @var bool - */ - protected $backupEnvironment = true; - /** * Set up */ @@ -80,50 +72,6 @@ protected function createConfigurationManagerWithMockedMethods(array $methods) ->getMock(); } - /** - * Moves existing files in PATH_site . typo3conf/ to a different location - * @test - */ - public function configurationFilesAreMovedToConfigDirectoryIfEnvironmentVariableIsSet() - { - Environment::initialize( - new ApplicationContext('Development'), - true, - false, - rtrim(PATH_site, '/'), - rtrim(PATH_site, '/'), - PATH_site . 'var', - PATH_site . 'typo3temp/var/tests/' . uniqid('config', true), - PATH_thisScript, - 'WINDOWS' - ); - - $filesToCreate = [ - 'LocalConfiguration.php', - 'AdditionalConfiguration.php', - 'AdditionalFactoryConfiguration.php', - ]; - - foreach ($filesToCreate as $fileToCreate) { - touch(PATH_typo3conf . $fileToCreate); - } - - $this->createConfigurationManagerWithMockedMethods(['exportConfiguration']); - $this->configurationManager->expects($this->once())->method('exportConfiguration'); - - $subject = new SilentConfigurationUpgradeService($this->configurationManager); - $subject->migrateConfigurationFiles(); - - foreach ($filesToCreate as $file) { - $this->testFilesToDelete[] = Environment::getConfigPath() . '/' . $file; - - // Check if the new file is placed - $this->assertFileExists(Environment::getConfigPath() . '/' . $file); - // Check if the old files do not exist anymore - $this->assertFileNotExists(PATH_typo3conf . $file); - } - } - /** * Dataprovider for configureBackendLoginSecurity *