From 79ec0e8bbc4b0c4f7b4a829410c570640605e3e7 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Sat, 31 Jan 2015 12:01:09 +0100 Subject: [PATCH] [BUGFIX] Improve functional test execution on Windows system On Windows systems you can execute several commands using '&' like set typo3DatabaseUsername=root & set typo3DatabasePassword=root. Unfortunately Windows sets those parameter with a trailing space. This causes database connections not to work. Therefore the patch adds a trim on getting system environment variables for database credentials for functional tests. Furthermore the PHP versions on Windows throw a warning on setting the database name when the connection is closed. The warning is caught by PHPUnit but the database tables aren't initialized correctly. This patch adds an '@' to mute the warning. Releases: master, 6.2 Resolves: #64680 Change-Id: If649b5bd440a3bd504f028a3c9c96c9d294d380c Reviewed-on: http://review.typo3.org/36491 Reviewed-by: Oliver Klee Reviewed-by: Helmut Hummel Tested-by: Helmut Hummel --- .../Tests/FunctionalTestCaseBootstrapUtility.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php b/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php index 9a402f52e813..b671746bff65 100644 --- a/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php +++ b/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php @@ -264,12 +264,12 @@ class FunctionalTestCaseBootstrapUtility { * @return void */ protected function setUpLocalConfiguration(array $configurationToMerge) { - $databaseName = getenv('typo3DatabaseName'); - $databaseHost = getenv('typo3DatabaseHost'); - $databaseUsername = getenv('typo3DatabaseUsername'); - $databasePassword = getenv('typo3DatabasePassword'); - $databasePort = getenv('typo3DatabasePort'); - $databaseSocket = getenv('typo3DatabaseSocket'); + $databaseName = trim(getenv('typo3DatabaseName')); + $databaseHost = trim(getenv('typo3DatabaseHost')); + $databaseUsername = trim(getenv('typo3DatabaseUsername')); + $databasePassword = trim(getenv('typo3DatabasePassword')); + $databasePort = trim(getenv('typo3DatabasePort')); + $databaseSocket = trim(getenv('typo3DatabaseSocket')); if ($databaseName || $databaseHost || $databaseUsername || $databasePassword || $databasePort || $databaseSocket) { // Try to get database credentials from environment variables first $originalConfigurationArray = array( @@ -468,7 +468,8 @@ class FunctionalTestCaseBootstrapUtility { ); } $database->setDatabaseName($this->databaseName); - $database->sql_select_db(); + // On windows, this still works, but throws a warning, which we need to discard. + @$database->sql_select_db(); } /** -- 2.20.1