Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.

Commit 6491def

Browse files
zero-24javigomez
authored andcommitted
Small tweeks to the RoboFile (#75)
* robo * robo
1 parent b7e7cbd commit 6491def

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

RoboFile.php

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
<?php
22
/**
3-
* This is joomla project's console command file for Robo.li task runner.
4-
*
5-
* Download robo.phar from http://robo.li/robo.phar and type in the root of the repo: $ php robo.phar
6-
* Or do: $ composer update, and afterwards you will be able to execute robo like $ php libraries/vendor/bin/robo
7-
*
83
* @package Joomla.Site
94
* @subpackage RoboFile
105
*
116
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
127
* @license GNU General Public License version 2 or later; see LICENSE.txt
8+
*/
9+
10+
/**
11+
* This is joomla project's console command file for Robo.li task runner.
12+
*
13+
* Download robo.phar from http://robo.li/robo.phar and type in the root of the repo: $ php robo.phar
14+
* Or do: $ composer update, and afterwards you will be able to execute robo like $ php libraries/vendor/bin/robo
15+
*
1316
* @see http://robo.li/
1417
*/
1518
require_once __DIR__ . '/tests/codeception/vendor/autoload.php';
@@ -58,13 +61,14 @@ class RoboFile extends \Robo\Tasks
5861
/**
5962
* RoboFile constructor.
6063
*
61-
* @since __DEPLOY_VERSION__
64+
* @since __DEPLOY_VERSION__
65+
*
66+
* @return void
6267
*/
6368
public function __construct()
6469
{
6570
$this->configuration = $this->getConfiguration();
66-
67-
$this->cmsPath = $this->getTestingPath();
71+
$this->cmsPath = $this->getTestingPath();
6872

6973
// Set default timezone (so no warnings are generated if it is not set)
7074
date_default_timezone_set('UTC');
@@ -73,9 +77,9 @@ public function __construct()
7377
/**
7478
* Get (optional) configuration from an external file
7579
*
76-
* @since __DEPLOY_VERSION__
80+
* @since __DEPLOY_VERSION__
7781
*
78-
* @return \stdClass|null
82+
* @return \stdClass|null
7983
*/
8084
public function getConfiguration()
8185
{
@@ -103,9 +107,9 @@ public function getConfiguration()
103107
/**
104108
* Get the correct CMS root path
105109
*
106-
* @since __DEPLOY_VERSION__
110+
* @since __DEPLOY_VERSION__
107111
*
108-
* @return string
112+
* @return string
109113
*/
110114
private function getTestingPath()
111115
{
@@ -116,7 +120,7 @@ private function getTestingPath()
116120

117121
if (!file_exists(dirname($this->configuration->cmsPath)))
118122
{
119-
$this->say("Cms path written in local configuration does not exists or is not readable");
123+
$this->say("CMS path written in local configuration does not exists or is not readable");
120124

121125
return $this->testsPath . 'joomla-cms3';
122126
}
@@ -129,7 +133,7 @@ private function getTestingPath()
129133
*
130134
* @since __DEPLOY_VERSION__
131135
*
132-
* @return bool
136+
* @return bool This is allways true
133137
*/
134138
public function build()
135139
{
@@ -139,13 +143,13 @@ public function build()
139143
/**
140144
* Creates a testing Joomla site for running the tests (use it before run:test)
141145
*
142-
* @param bool $use_htaccess (1/0) Rename and enable embedded Joomla .htaccess file
146+
* @param bool $useHtaccess (1/0) Rename and enable embedded Joomla .htaccess file
143147
*
144148
* @since __DEPLOY_VERSION__
145149
*
146150
* @return void
147151
*/
148-
public function createTestingSite($use_htaccess = false)
152+
public function createTestingSite($useHtaccess = false)
149153
{
150154
// Clean old testing site
151155
if (is_dir($this->cmsPath))
@@ -157,7 +161,8 @@ public function createTestingSite($use_htaccess = false)
157161
catch (Exception $e)
158162
{
159163
// Sorry, we tried :(
160-
$this->say('Sorry, you will have to delete ' . $this->cmsPath . ' manually. ');
164+
$this->say('Sorry, you will have to delete ' . $this->cmsPath . ' manually.');
165+
161166
exit(1);
162167
}
163168
}
@@ -175,7 +180,7 @@ public function createTestingSite($use_htaccess = false)
175180
}
176181

177182
// Optionally uses Joomla default htaccess file. Used by TravisCI
178-
if ($use_htaccess == true)
183+
if ($useHtaccess == true)
179184
{
180185
$this->say("Renaming htaccess.txt to .htaccess");
181186
$this->_copy('./htaccess.txt', $this->cmsPath . '/.htaccess');
@@ -242,7 +247,7 @@ protected function copyJoomla($dst, $exclude = array())
242247
*
243248
* @since __DEPLOY_VERSION__
244249
*
245-
* @return void
250+
* @return void
246251
*/
247252
private function getComposer()
248253
{
@@ -387,7 +392,6 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
387392
*/
388393
}
389394

390-
391395
/**
392396
* Executes a specific Selenium System Tests in your machine
393397
*
@@ -418,8 +422,9 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
418422
);
419423

420424
$tests = array();
425+
$i = 1;
426+
421427
$iterator->rewind();
422-
$i = 1;
423428

424429
while ($iterator->valid())
425430
{
@@ -428,6 +433,7 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
428433
|| strripos($iterator->getSubPathName(), '.feature'))
429434
{
430435
$this->say('[' . $i . '] ' . $iterator->getSubPathName());
436+
431437
$tests[$i] = $iterator->getSubPathName();
432438
$i++;
433439
}
@@ -436,7 +442,7 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
436442
}
437443

438444
$this->say('');
439-
$testNumber = $this->ask('Type the number of the test in the list that you want to run...');
445+
$testNumber = $this->ask('Type the number of the test in the list that you want to run...');
440446
$test = $tests[$testNumber];
441447
}
442448

@@ -456,7 +462,9 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
456462

457463
$className = explode(".", $fileName[1]);
458464
$class_methods = get_class_methods($className[0]);
465+
459466
$this->say('[' . $i . '] ' . 'All');
467+
460468
$methods[$i] = 'All';
461469
$i++;
462470

@@ -467,7 +475,7 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
467475
if (!$reflect->isConstructor() && $reflect->isPublic())
468476
{
469477
$this->say('[' . $i . '] ' . $method_name);
470-
478+
471479
$methods[$i] = $method_name;
472480

473481
$i++;

0 commit comments

Comments
 (0)