Skip to content

Commit 976841e

Browse files
committed
Merge pull request #39 from puneet0191/installFromFolder
Adding installExtensionFromFolder function
2 parents 2de451d + 7bceb24 commit 976841e

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ In between the available functions you can find:
2424
* search for item
2525
* check for item existence
2626
* EXTENSION MANAGER
27-
* install extension from directory
27+
* install extension from Folder
2828
* install extension from url
2929
* enable plugin
3030
* uninstall extension

src/JoomlaBrowser.php

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -237,28 +237,43 @@ public function setErrorReportingToDevelopment()
237237
* @param string $type Type of Extension
238238
*
239239
* @note: doAdminLogin() before
240+
*
241+
* @deprecated since Joomla 3.4.4-dev. Use installExtensionFromFolder($path, $type = 'Extension') instead.
240242
*/
241243
public function installExtensionFromDirectory($path, $type = 'Extension')
242244
{
243-
$I = $this;
244-
$I->amOnPage('/administrator/index.php?option=com_installer');
245-
$I->waitForText('Extensions: Install','30', ['css' => 'H1']);
246-
$I->click(['link' => 'Install from Folder']);
247-
$this->debug('I enter the Path');
248-
$I->fillField(['id' => 'install_directory'], $path);
249-
// @todo: we need to find a better locator for the following Install button
250-
$I->click(['xpath' => "//input[contains(@onclick,'Joomla.submitbutton3()')]"]); // Install button
251-
$I->waitForText('was successful','30', ['id' => 'system-message-container']);
252-
if ($type == 'Extension')
253-
{
254-
$this->debug('Extension successfully installed from ' . $path);
255-
}
256-
if ($type == 'Plugin')
257-
{
258-
$this->debug('Installing plugin was successful.' . $path);
259-
}
245+
$this->debug('Suggested to use installExtensionFromFolder instead of installExtensionFromDirectory');
246+
$this->installExtensionFromFolder($path, $type);
260247
}
261248

249+
/**
250+
* Installs a Extension in Joomla that is located in a folder inside the server
251+
*
252+
* @param String $path Path for the Extension
253+
* @param string $type Type of Extension
254+
*
255+
* @note: doAdminLogin() before
256+
*/
257+
public function installExtensionFromFolder($path, $type = 'Extension')
258+
{
259+
$I = $this;
260+
$I->amOnPage('/administrator/index.php?option=com_installer');
261+
$I->waitForText('Extensions: Install','30', ['css' => 'H1']);
262+
$I->click(['link' => 'Install from Folder']);
263+
$this->debug('I enter the Path');
264+
$I->fillField(['id' => 'install_directory'], $path);
265+
// @todo: we need to find a better locator for the following Install button
266+
$I->click(['xpath' => "//input[contains(@onclick,'Joomla.submitbutton3()')]"]); // Install button
267+
$I->waitForText('was successful','30', ['id' => 'system-message-container']);
268+
if ($type == 'Extension')
269+
{
270+
$this->debug('Extension successfully installed from ' . $path);
271+
}
272+
if ($type == 'Plugin')
273+
{
274+
$this->debug('Installing plugin was successful.' . $path);
275+
}
276+
}
262277
/**
263278
* Installs a Extension in Joomla that is located in a url
264279
*

0 commit comments

Comments
 (0)