[TASK] Functional tests: error if DB permissions are missing 88/23388/3
authorSascha Egerer <sascha.egerer@dkd.de>
Tue, 27 Aug 2013 19:55:31 +0000 (21:55 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 28 Aug 2013 10:49:59 +0000 (12:49 +0200)
The functional test framework needs create and drop
table database permissions.

Added a check that outputs an error message if the DB user
is not able to connect to the database or if the user
has not the required permissions to create a database.

Resolves: #51381
Releases: 6.2
Change-Id: I94c4eeb4356fdba06026ec727283807112c53926
Reviewed-on: https://review.typo3.org/23388
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php

index da71a8a..f62d01e 100644 (file)
@@ -287,7 +287,14 @@ class FunctionalTestCaseBootstrapUtility {
                \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeTypo3DbGlobal();
                /** @var \TYPO3\CMS\Core\Database\DatabaseConnection $database */
                $database = $GLOBALS['TYPO3_DB'];
-               $database->sql_pconnect();
+               if(!$database->sql_pconnect()) {
+                       throw new Exception(
+                               'TYPO3 Fatal Error: The current username, password or host was not accepted when the'
+                               . ' connection to the database was attempted to be established!',
+                               1377620117
+                       );
+               }
+
                // Drop database in case a previous test had a fatal and did not clean up properly
                $database->admin_query('DROP DATABASE IF EXISTS `' . $this->databaseName . '`');
                $createDatabaseResult = $database->admin_query('CREATE DATABASE `' . $this->databaseName . '`');