[BUGFIX] Do not remove LocalConfiguration if executing unit tests 13/58113/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 1 Sep 2018 13:04:44 +0000 (15:04 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 1 Sep 2018 13:20:38 +0000 (15:20 +0200)
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 <richard@maxserv.com>
Tested-by: Richard Haeser <richard@maxserv.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php

index f4fd0f0..34cfe34 100644 (file)
@@ -18,8 +18,6 @@ namespace TYPO3\CMS\Install\Tests\Unit\Service;
 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;
@@ -47,12 +45,6 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase
     protected $backupPackageManager;
 
     /**
-     * restore Environment after each test
-     * @var bool
-     */
-    protected $backupEnvironment = true;
-
-    /**
      * Set up
      */
     protected function setUp()
@@ -81,50 +73,6 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase
     }
 
     /**
-     * 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
      *
      * @return array