diff --git a/src/JoomlaBrowser.php b/src/JoomlaBrowser.php index e5cf096..4e5ab39 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, which needs to reside 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 *