Skip to content

Commit

Permalink
Merge pull request #1 from zero-24/patch-1
Browse files Browse the repository at this point in the history
Give the robo some CS love
  • Loading branch information
javigomez committed Jun 10, 2015
2 parents 7a5964e + 0d46dab commit 9569f79
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,24 @@ public function runTests($seleniumPath = null, $suite = 'acceptance')
*/
public function runTest($seleniumPath = null, $pathToTestFile = null, $suite = 'acceptance')
{
if (!$seleniumPath) {
if (!file_exists('selenium-server-standalone.jar')) {
if (!$seleniumPath)
{
if (!file_exists('selenium-server-standalone.jar'))
{
$this->say('Downloading Selenium Server, this may take a while.');
$this->taskExec('wget')
->arg('http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar')
->arg('-O selenium-server-standalone.jar')
->printed(false)
->run();
}

$seleniumPath = 'selenium-server-standalone.jar';
}

// 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->taskComposerUpdate()->run();
Expand All @@ -174,8 +178,8 @@ public function runTest($seleniumPath = null, $pathToTestFile = null, $suite = '
$tests = array();
$this->say('Available tests in the system:');
$filesInSuite = scandir(getcwd() . '/tests/' . $suite);

$i = 1;

foreach ($filesInSuite as $file)
{
// Make sure the file is a Test file
Expand All @@ -186,8 +190,9 @@ public function runTest($seleniumPath = null, $pathToTestFile = null, $suite = '
$i++;
}
}

$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];
}

Expand All @@ -204,10 +209,13 @@ public function runTest($seleniumPath = null, $pathToTestFile = null, $suite = '
$this->say('Printing Selenium Log files');
$this->say('------ selenium-errors.log (start) ---------');
$seleniumErrors = file_get_contents('selenium-errors.log');
if ($seleniumErrors) {

if ($seleniumErrors)
{
$this->say(file_get_contents('selenium-errors.log'));
}
else {
else
{
$this->say('no errors were found');
}
$this->say('------ selenium-errors.log (end) -----------');
Expand Down Expand Up @@ -235,4 +243,4 @@ public function createTestingSite()
$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');
}
}
}

0 comments on commit 9569f79

Please sign in to comment.