Skip to content

Commit d925f50

Browse files
committed
Merge remote-tracking branch 'origin/B2B-1986-PR' into B2B-2079-combined
2 parents 3d4095f + a9cccc5 commit d925f50

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

dev/tests/setup-integration/etc/install-config-mysql.php.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ return [
1010
'db-user' => '{{db-user}}',
1111
'db-password' => '{{db-password}}',
1212
'db-name' => '{{db-name}}',
13+
'db-init-statements' => '{{db-init-statements}}',
1314
'db-prefix' => '',
1415
'backend-frontname' => 'admin',
1516
'admin-user' => 'admin',

dev/tests/setup-integration/framework/bootstrap.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@
8383
$application->createInstallDir();
8484
//We do not want to install anything
8585
$application->initialize([]);
86-
$application->cleanup();
86+
87+
if ($settings->getAsBoolean('TESTS_CLEANUP')) {
88+
$application->cleanup();
89+
}
8790

8891
\Magento\TestFramework\Helper\Bootstrap::setInstance(new \Magento\TestFramework\Helper\Bootstrap($bootstrap));
8992

setup/src/Magento/Setup/Validator/DbValidator.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,15 @@ public function checkDatabaseConnectionWithDriverOptions(
141141
*/
142142
private function checkDatabaseName(\Magento\Framework\DB\Adapter\AdapterInterface $connection, $dbName)
143143
{
144-
$query = "SHOW DATABASES";
145-
$accessibleDbs = $connection->query($query)->fetchAll(\PDO::FETCH_COLUMN, 0);
146-
foreach ($accessibleDbs as $accessibleDbName) {
147-
if ($dbName == $accessibleDbName) {
148-
return true;
149-
}
144+
try {
145+
$connection->query("SHOW TABLES FROM $dbName")->fetchAll(\PDO::FETCH_COLUMN, 0);
146+
return true;
147+
} catch (\Exception $e) {
148+
throw new \Magento\Setup\Exception(
149+
"Database '{$dbName}' does not exist "
150+
. "or specified database server user does not have privileges to access this database."
151+
);
150152
}
151-
throw new \Magento\Setup\Exception(
152-
"Database '{$dbName}' does not exist "
153-
."or specified database server user does not have privileges to access this database."
154-
);
155153
}
156154

157155
/**

0 commit comments

Comments
 (0)