Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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