Skip to content

Commit

Permalink
Merge pull request #154 from puneet0191/customDbDetails
Browse files Browse the repository at this point in the history
Adding support for Custom Db name and Prefix
  • Loading branch information
rdeutz authored Dec 28, 2017
2 parents 03c1335 + 8d60fe3 commit ad0751d
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions src/JoomlaBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,25 @@ public function doFrontendLogout()
/**
* Installs Joomla
*
* @param string|null $databaseName Optional Database Name. If not passed the one in acceptance.suite.yml will be used
* @param string|null $databasePrefix Optional Database Prefix. If not passed the one in acceptance.suite.yml will be used
*
* @return void
*
* @since 3.0.0
*/
public function installJoomla()
public function installJoomla($databaseName = null, $databasePrefix = null)
{
if (is_null($databaseName))
{
$databaseName = $this->config['database name'];
}

if (is_null($databasePrefix))
{
$databasePrefix = $this->config['database prefix'];
}

$this->debug('I open Joomla Installation Configuration Page');
$this->amOnPage('/installation/index.php');
$this->debug('I check that FTP tab is not present in installation. Otherwise it means that I have not enough '
Expand Down Expand Up @@ -258,9 +271,9 @@ public function installJoomla()
$this->debug('I fill Database Password');
$this->fillField(['id' => 'jform_db_pass'], $this->config['database password']);
$this->debug('I fill Database Name');
$this->fillField(["id" => "jform_db_name"], $this->config["database name"]);
$this->fillField(["id" => "jform_db_name"], $databaseName);
$this->debug('I fill Database Prefix');
$this->fillField(["id" => "jform_db_prefix"], $this->config["database prefix"]);
$this->fillField(["id" => "jform_db_prefix"], $databasePrefix);
$this->debug('I click Remove Old Database ');
$this->selectOptionInRadioField('Old Database Process', 'Remove');
$this->debug('I click Next');
Expand All @@ -286,13 +299,16 @@ public function installJoomla()
/**
* Install Joomla removing the Installation folder at the end of the execution
*
* @param string|null $databaseName Optional Database Name. If not passed the one in acceptance.suite.yml will be used
* @param string|null $databasePrefix Optional Database Prefix. If not passed the one in acceptance.suite.yml will be used
*
* @return void
*
* @since 3.0.0
*/
public function installJoomlaRemovingInstallationFolder()
public function installJoomlaRemovingInstallationFolder($databaseName = null, $databasePrefix = null)
{
$this->installJoomla();
$this->installJoomla($databaseName, $databasePrefix);

$this->debug('Removing Installation Folder');
$this->click(['xpath' => "//input[@value='Remove \"installation\" folder']"]);
Expand All @@ -308,22 +324,24 @@ public function installJoomlaRemovingInstallationFolder()
* Installs Joomla with Multilingual Feature active
*
* @param array $languages Array containing the language names to be installed
* @param string|null $databaseName Optional Database Name. If not passed the one in acceptance.suite.yml will be used
* @param string|null $databasePrefix Optional Database Prefix. If not passed the one in acceptance.suite.yml will be used
*
* @example: $this->installJoomlaMultilingualSite(['Spanish', 'French']);
*
* @return void
*
* @since 3.0.0
*/
public function installJoomlaMultilingualSite($languages = array())
public function installJoomlaMultilingualSite($languages = array(), $databaseName = null, $databasePrefix = null)
{
if (!$languages)
{
// If no language is passed French will be installed by default
$languages[] = 'French';
}

$this->installJoomla();
$this->installJoomla($databaseName, $databasePrefix);

$this->debug('I go to Install Languages page');
$this->click(['id' => 'instLangs']);
Expand Down

0 comments on commit ad0751d

Please sign in to comment.