From f9408cc09d7712ecc6818bc1c88c0aa051e192a2 Mon Sep 17 00:00:00 2001 From: Tito Alvarez Date: Sat, 17 Dec 2016 10:15:13 -0600 Subject: [PATCH 1/2] Added option for uploading extension file for client/server environments --- src/JoomlaBrowser.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/JoomlaBrowser.php b/src/JoomlaBrowser.php index e5cf096..34bc0ae 100644 --- a/src/JoomlaBrowser.php +++ b/src/JoomlaBrowser.php @@ -359,7 +359,7 @@ public function installExtensionFromFolder($path, $type = 'Extension') /** * Installs a Extension in Joomla that is located in a url * - * @param String $url Url address to the .zip file + * @param string $url Url address to the .zip file * @param string $type Type of Extension * * {@internal doAdminLogin() before} @@ -393,6 +393,43 @@ public function installExtensionFromUrl($url, $type = 'Extension') } } + /** + * Installs a Extension in Joomla using the file upload option + * + * @param string $file Path to the file in the _data folder + * @param string $type Type of Extension + * + * {@internal doAdminLogin() before} + * + * @return void + */ + public function installExtensionFromFileUpload($file, $type = 'Extension') + { + $I = $this; + $I->amOnPage('/administrator/index.php?option=com_installer'); + $I->waitForText('Extensions: Install', '30', ['css' => 'H1']); + $I->click(['link' => 'Upload Package File']); + $this->debug('I enter the file input'); + $I->attachFile(['id' => 'install_package'], $file); + $I->click(['id' => 'installbutton_package']); + $I->waitForText('was successful', '30', ['id' => 'system-message-container']); + + if ($type == 'Extension') + { + $this->debug('Extension successfully installed.'); + } + + if ($type == 'Plugin') + { + $this->debug('Installing plugin was successful.'); + } + + if ($type == 'Package') + { + $this->debug('Installation of the package was successful.'); + } + } + /** * Function to check for PHP Notices or Warnings * From 465dd95178c1e777fcdce68fe28557917f84df49 Mon Sep 17 00:00:00 2001 From: Tito Alvarez Date: Thu, 6 Apr 2017 10:14:24 -0600 Subject: [PATCH 2/2] Better comment for upload an cs --- src/JoomlaBrowser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JoomlaBrowser.php b/src/JoomlaBrowser.php index 34bc0ae..4e5ab39 100644 --- a/src/JoomlaBrowser.php +++ b/src/JoomlaBrowser.php @@ -396,7 +396,7 @@ public function installExtensionFromUrl($url, $type = 'Extension') /** * Installs a Extension in Joomla using the file upload option * - * @param string $file Path to the file in the _data folder + * @param string $file Path to the file, which needs to reside in the _data folder * @param string $type Type of Extension * * {@internal doAdminLogin() before}