Skip to content

Commit

Permalink
[BUGFIX] Do not remove LocalConfiguration if executing unit tests
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
lolli42 authored and maddy2101 committed Sep 1, 2018
1 parent a11734f commit e0c5ac1
Showing 1 changed file with 0 additions and 52 deletions.
Expand Up @@ -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;
Expand All @@ -46,12 +44,6 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase
*/
protected $backupPackageManager;

/**
* restore Environment after each test
* @var bool
*/
protected $backupEnvironment = true;

/**
* Set up
*/
Expand Down Expand 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
*
Expand Down

0 comments on commit e0c5ac1

Please sign in to comment.