codestyle + fix windows webdriver load

This commit is contained in:
Jelle Kok 2019-08-13 04:18:48 +02:00
parent 8712d4033a
commit 3b155af6e9
No known key found for this signature in database
GPG Key ID: EC8776F3C011B1D1
3 changed files with 36 additions and 33 deletions

View File

@ -12,6 +12,9 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt * @license GNU General Public License version 2 or later; see LICENSE.txt
*/ */
use Joomla\Testing\Robo\Tasks\loadTasks;
use Robo\Tasks;
require_once 'vendor/autoload.php'; require_once 'vendor/autoload.php';
if (!defined('JPATH_BASE')) if (!defined('JPATH_BASE'))
@ -26,11 +29,11 @@ if (!defined('JPATH_BASE'))
* *
* @since 1.0 * @since 1.0
*/ */
class RoboFile extends \Robo\Tasks class RoboFile extends Tasks
{ {
// Load tasks from composer, see composer.json // Load tasks from composer, see composer.json
use \Joomla\Testing\Robo\Tasks\loadTasks; use loadTasks;
use \Joomla\Jorobo\Tasks\loadTasks; use Joomla\Jorobo\Tasks\loadTasks;
/** /**
* File extension for executables * File extension for executables
@ -77,23 +80,14 @@ class RoboFile extends \Robo\Tasks
/** /**
* Get the executable extension according to Operating System * Get the executable extension according to Operating System
* *
* @return void * @return string
*/ */
private function getExecutableExtension() private function getExecutableExtension()
{ {
if ($this->isWindows()) if ($this->isWindows())
{
// Check whether git.exe or git as command should be used,
// As on window both is possible
if (!$this->_exec('git.exe --version')->getMessage())
{
return '';
}
else
{ {
return '.exe'; return '.exe';
} }
}
return ''; return '';
} }
@ -106,6 +100,7 @@ class RoboFile extends \Robo\Tasks
* - 'env': set a specific environment to get configuration from * - 'env': set a specific environment to get configuration from
* *
* @return mixed * @return mixed
* @throws \Codeception\Exception\ConfigurationException
*/ */
public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop']) public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
{ {
@ -166,6 +161,8 @@ class RoboFile extends \Robo\Tasks
* @param string $suite Optional name of the suite containing the tests, Acceptance by default. * @param string $suite Optional name of the suite containing the tests, Acceptance by default.
* *
* @return mixed * @return mixed
* @throws ReflectionException
* @throws \Codeception\Exception\ConfigurationException
*/ */
public function runTest($pathToTestFile = null, $suite = 'acceptance') public function runTest($pathToTestFile = null, $suite = 'acceptance')
{ {
@ -441,14 +438,15 @@ class RoboFile extends \Robo\Tasks
* Runs Selenium Standalone Server. * Runs Selenium Standalone Server.
* *
* @return void * @return void
* @throws \Codeception\Exception\ConfigurationException
*/ */
public function runSelenium() public function runSelenium()
{ {
if ($this->isWindows()) if ($this->isWindows())
{ {
// TODO: Move this logic to the selenium standalone server task in the parent joomla repo // TODO: Move this logic to the selenium standalone server task in the parent joomla repo
$this->_exec('START java.exe -jar' . $this->getWebDriver() . $this->_exec('START java.exe -jar ' . $this->getWebDriver() .
' vendor\joomla-projects\selenium-server-standalone\bin\selenium-server-standalone.jar '); ' .\\vendor\\joomla-projects\\selenium-server-standalone\\bin\\selenium-server-standalone.jar ');
sleep(3); sleep(3);
} }
else else
@ -585,6 +583,7 @@ class RoboFile extends \Robo\Tasks
* @return string the webdriver string to use with selenium * @return string the webdriver string to use with selenium
* *
* @since version * @since version
* @throws \Codeception\Exception\ConfigurationException
*/ */
public function getWebdriver() public function getWebdriver()
{ {
@ -695,9 +694,9 @@ class RoboFile extends \Robo\Tasks
* *
* @param String $target The target joomla instance * @param String $target The target joomla instance
* *
* @return void
* @since __DEPLOY_VERSION__ * @since __DEPLOY_VERSION__
* *
* @return void
*/ */
public function map($target) public function map($target)
{ {

View File

@ -25,6 +25,7 @@ class category extends \AcceptanceTester
* @param String $categoryName Name of the Category which is to be created * @param String $categoryName Name of the Category which is to be created
* *
* @return void * @return void
* @throws \Exception
*/ */
public function createCategory($categoryName) public function createCategory($categoryName)
{ {
@ -50,6 +51,7 @@ class category extends \AcceptanceTester
* @param String $categoryName Name of the category which is to be trashed * @param String $categoryName Name of the category which is to be trashed
* *
* @return void * @return void
* @throws \Exception
*/ */
public function trashCategory($categoryName) public function trashCategory($categoryName)
{ {
@ -69,6 +71,7 @@ class category extends \AcceptanceTester
* @param String $categoryName Name of the category which is to be deleted * @param String $categoryName Name of the category which is to be deleted
* *
* @return void * @return void
* @throws \Exception
*/ */
public function deleteCategory($categoryName) public function deleteCategory($categoryName)
{ {

View File

@ -20,6 +20,7 @@ class weblink extends \AcceptanceTester
* @param string $url The url for the weblink * @param string $url The url for the weblink
* @param string $countClicks If not null, we set the "Count Clicks" weblink property to the given value. * @param string $countClicks If not null, we set the "Count Clicks" weblink property to the given value.
* *
* @throws \Exception
*/ */
public function createWeblink($title, $url, $countClicks = null) public function createWeblink($title, $url, $countClicks = null)
{ {