30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-03 06:50:49 +00:00

Give the robo some CS love

This commit is contained in:
zero-24 2015-06-09 19:10:05 +02:00
parent 7a5964e8dd
commit 0d46dab534

View File

@ -141,8 +141,10 @@ class RoboFile extends \Robo\Tasks
*/ */
public function runTest($seleniumPath = null, $pathToTestFile = null, $suite = 'acceptance') public function runTest($seleniumPath = null, $pathToTestFile = null, $suite = 'acceptance')
{ {
if (!$seleniumPath) { if (!$seleniumPath)
if (!file_exists('selenium-server-standalone.jar')) { {
if (!file_exists('selenium-server-standalone.jar'))
{
$this->say('Downloading Selenium Server, this may take a while.'); $this->say('Downloading Selenium Server, this may take a while.');
$this->taskExec('wget') $this->taskExec('wget')
->arg('http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar') ->arg('http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar')
@ -150,11 +152,13 @@ class RoboFile extends \Robo\Tasks
->printed(false) ->printed(false)
->run(); ->run();
} }
$seleniumPath = 'selenium-server-standalone.jar'; $seleniumPath = 'selenium-server-standalone.jar';
} }
// Make sure we have Composer // Make sure we have Composer
if (!file_exists('./composer.phar')) { if (!file_exists('./composer.phar'))
{
$this->_exec('curl -sS https://getcomposer.org/installer | php'); $this->_exec('curl -sS https://getcomposer.org/installer | php');
} }
$this->taskComposerUpdate()->run(); $this->taskComposerUpdate()->run();
@ -174,8 +178,8 @@ class RoboFile extends \Robo\Tasks
$tests = array(); $tests = array();
$this->say('Available tests in the system:'); $this->say('Available tests in the system:');
$filesInSuite = scandir(getcwd() . '/tests/' . $suite); $filesInSuite = scandir(getcwd() . '/tests/' . $suite);
$i = 1; $i = 1;
foreach ($filesInSuite as $file) foreach ($filesInSuite as $file)
{ {
// Make sure the file is a Test file // Make sure the file is a Test file
@ -186,8 +190,9 @@ class RoboFile extends \Robo\Tasks
$i++; $i++;
} }
} }
$this->say(''); $this->say('');
$testNumber = $this->ask('Type the number of the test in the list that you want to run...'); $testNumber = $this->ask('Type the number of the test in the list that you want to run...');
$pathToTestFile = "tests/$suite/" . $tests[$testNumber]; $pathToTestFile = "tests/$suite/" . $tests[$testNumber];
} }
@ -204,10 +209,13 @@ class RoboFile extends \Robo\Tasks
$this->say('Printing Selenium Log files'); $this->say('Printing Selenium Log files');
$this->say('------ selenium-errors.log (start) ---------'); $this->say('------ selenium-errors.log (start) ---------');
$seleniumErrors = file_get_contents('selenium-errors.log'); $seleniumErrors = file_get_contents('selenium-errors.log');
if ($seleniumErrors) {
if ($seleniumErrors)
{
$this->say(file_get_contents('selenium-errors.log')); $this->say(file_get_contents('selenium-errors.log'));
} }
else { else
{
$this->say('no errors were found'); $this->say('no errors were found');
} }
$this->say('------ selenium-errors.log (end) -----------'); $this->say('------ selenium-errors.log (end) -----------');
@ -235,4 +243,4 @@ class RoboFile extends \Robo\Tasks
$this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/joomla-cms3'); $this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/joomla-cms3');
$this->say('Joomla CMS site created at tests/joomla-cms3'); $this->say('Joomla CMS site created at tests/joomla-cms3');
} }
} }