Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad4025d

Browse files
RoSk0weitzman
authored andcommitted
DB prefix ignored when installing site. (#3849)
1 parent 7d06629 commit ad4025d

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/Sql/SqlBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function create($options = [])
9292
if ($url = $options['db-url']) {
9393
$url = is_array($url) ? $url[$database] : $url;
9494
$db_spec = self::dbSpecFromDbUrl($url);
95-
$db_spec['db_prefix'] = $options['db-prefix'];
95+
$db_spec['prefix'] = $options['db-prefix'];
9696
return self::getInstance($db_spec, $options);
9797
} elseif (($databases = $options['databases']) && (array_key_exists($database, $databases)) && (array_key_exists($target, $databases[$database]))) {
9898
// @todo 'databases' option is not declared anywhere?
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace Unish;
4+
5+
/**
6+
* @group base
7+
* @group slow
8+
*/
9+
class SiteInstallCommandCase extends CommandUnishTestCase
10+
{
11+
12+
/**
13+
* Test functionality of site set.
14+
*/
15+
public function testSiteInstallPrefix()
16+
{
17+
// Install Drupal in "drupal_" prefix.
18+
$this->installDrupal('dev', true, ['db-prefix' => 'drupal_']);
19+
20+
// Run 'core-status' and insure that we can bootstrap Drupal.
21+
$this->drush('core-status', [], ['fields' => 'bootstrap']);
22+
$output = $this->getOutput();
23+
$this->assertContains('Successful', $output);
24+
25+
// Issue a query and check the result to verify the connection.
26+
$this->drush('sql:query', ["SELECT uid FROM drupal_users where uid = 1;"]);
27+
$output = $this->getOutput();
28+
$this->assertContains('1', $output);
29+
}
30+
}

0 commit comments

Comments
 (0)