Skip to content

Commit

Permalink
[!!!][TASK] Remove functional test database configuration fallback
Browse files Browse the repository at this point in the history
Functional tests per nature speaks with a concrete atabase service,
which can be configured using a et of `environment variables`.
However, historically a fallback to `typo3conf/LocalConfiguration.php`
or the root project has been used if no environment variable has been
provided.

This broke already in early TYPO3 v12 development cycle with the
move towards configuration files outside of the public root folder
in a composer based installation.

Because of today usage of the testing-framework and the broader
acceptance of ci/cd pipelines the environment variables are the
recommended configuration option. Remove the broken fallback now.

Resolves: #474
Releases: main
  • Loading branch information
sbuerk committed Jan 31, 2024
1 parent a620020 commit b747b5d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Classes/Core/Testbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,9 @@ public function providePathsInTestInstance(string $instancePath, array $pathsToP

/**
* Database settings for functional and acceptance tests can be either set by
* environment variables (recommended), or from an existing LocalConfiguration as fallback.
* The method fetches these.
* environment variables (recommended). The method fetches these.
*
* An unique name will be added to the database name later.
* A unique name will be added to the database name later.
*
* @param array $config Incoming config arguments, used especially in acceptance test setups
* @throws Exception
Expand Down Expand Up @@ -482,9 +481,6 @@ public function getOriginalDatabaseSettingsFromEnvironmentOrLocalConfiguration(a
if ($databaseCharset) {
$originalConfigurationArray['DB']['Connections']['Default']['charset'] = $databaseCharset;
}
} elseif (file_exists(ORIGINAL_ROOT . 'typo3conf/LocalConfiguration.php')) {
// See if a LocalConfiguration file exists in "parent" instance to get db credentials from
$originalConfigurationArray = require ORIGINAL_ROOT . 'typo3conf/LocalConfiguration.php';
} else {
throw new Exception(
'Database credentials for tests are neither set through environment'
Expand All @@ -496,7 +492,7 @@ public function getOriginalDatabaseSettingsFromEnvironmentOrLocalConfiguration(a
// Instead of letting code run and retrieving mysterious result and errors, check for dropped sql driver
// support and throw a corresponding exception with a proper message.
// @todo Remove this in core v13 compatible testing-framework.
if (in_array($originalConfigurationArray['DB']['Connections']['Default']['driver'] ?? '', ['sqlsrv', 'pdo_sqlsrv'], true)) {
if (in_array($originalConfigurationArray['DB']['Connections']['Default']['driver'], ['sqlsrv', 'pdo_sqlsrv'], true)) {
throw new \RuntimeException(
'Microsoft SQL Server support has been dropped for TYPO3 v12 and testing-framework.'
. ' Therefore driver "' . $databaseDriver . '" is invalid.',
Expand Down

0 comments on commit b747b5d

Please sign in to comment.