55 * Download robo.phar from http://robo.li/robo.phar and type in the root of the repo: $ php robo.phar
66 * Or do: $ composer update, and afterwards you will be able to execute robo like $ php libraries/vendor/bin/robo
77 *
8- * @see http://robo.li/
8+ * @package Joomla.Site
9+ * @subpackage RoboFile
10+ *
11+ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
12+ * @license GNU General Public License version 2 or later; see LICENSE.txt
13+ * @see http://robo.li/
914 */
1015require_once __DIR__ . '/tests/codeception/vendor/autoload.php ' ;
1116
1419 define ('JPATH_BASE ' , __DIR__ );
1520}
1621
22+ /**
23+ * Modern php task runner for Joomla! Browser Automated Tests execution
24+ *
25+ * @package RoboFile
26+ *
27+ * @since __DEPLOY_VERSION__
28+ */
1729class RoboFile extends \Robo \Tasks
1830{
1931 // Load tasks from composer, see composer.json
@@ -30,19 +42,23 @@ class RoboFile extends \Robo\Tasks
3042 /**
3143 * Local configuration parameters
3244 *
33- * @var array
45+ * @var array
46+ * @since __DEPLOY_VERSION__
3447 */
3548 private $ configuration = array ();
3649
3750 /**
3851 * Path to the local CMS test folder
3952 *
40- * @var string
53+ * @var string
54+ * @since __DEPLOY_VERSION__
4155 */
4256 protected $ cmsPath = null ;
4357
4458 /**
45- * Constructor
59+ * RoboFile constructor.
60+ *
61+ * @since __DEPLOY_VERSION__
4662 */
4763 public function __construct ()
4864 {
@@ -57,6 +73,8 @@ public function __construct()
5773 /**
5874 * Get (optional) configuration from an external file
5975 *
76+ * @since __DEPLOY_VERSION__
77+ *
6078 * @return \stdClass|null
6179 */
6280 public function getConfiguration ()
@@ -85,6 +103,8 @@ public function getConfiguration()
85103 /**
86104 * Get the correct CMS root path
87105 *
106+ * @since __DEPLOY_VERSION__
107+ *
88108 * @return string
89109 */
90110 private function getTestingPath ()
@@ -107,6 +127,8 @@ private function getTestingPath()
107127 /**
108128 * Build the Joomla CMS
109129 *
130+ * @since __DEPLOY_VERSION__
131+ *
110132 * @return bool
111133 */
112134 public function build ()
@@ -118,6 +140,10 @@ public function build()
118140 * Creates a testing Joomla site for running the tests (use it before run:test)
119141 *
120142 * @param bool $use_htaccess (1/0) Rename and enable embedded Joomla .htaccess file
143+ *
144+ * @since __DEPLOY_VERSION__
145+ *
146+ * @return void
121147 */
122148 public function createTestingSite ($ use_htaccess = false )
123149 {
@@ -162,10 +188,14 @@ public function createTestingSite($use_htaccess = false)
162188 /**
163189 * Copy the joomla installation excluding folders
164190 *
165- * @param string $dst Target folder
166- * @param array $exclude Exclude list of folders
191+ * @param string $dst Target folder
192+ * @param array $exclude Exclude list of folders
167193 *
168194 * @throws Exception
195+ *
196+ * @since __DEPLOY_VERSION__
197+ *
198+ * @return void
169199 */
170200 protected function copyJoomla ($ dst , $ exclude = array ())
171201 {
@@ -210,6 +240,8 @@ protected function copyJoomla($dst, $exclude = array())
210240 /**
211241 * Downloads Composer
212242 *
243+ * @since __DEPLOY_VERSION__
244+ *
213245 * @return void
214246 */
215247 private function getComposer ()
@@ -224,7 +256,9 @@ private function getComposer()
224256 /**
225257 * Runs Selenium Standalone Server.
226258 *
227- * @return void
259+ * @since __DEPLOY_VERSION__
260+ *
261+ * @return void
228262 */
229263 public function runSelenium ()
230264 {
@@ -252,10 +286,13 @@ public function runSelenium()
252286 /**
253287 * Executes all the Selenium System Tests in a suite on your machine
254288 *
255- * @param array $opts Array of configuration options:
256- * - 'use-htaccess': renames and enable embedded Joomla .htaccess file
257- * - 'env': set a specific environment to get configuration from
258- * @return mixed
289+ * @param array $opts Array of configuration options:
290+ * - 'use-htaccess': renames and enable embedded Joomla .htaccess file
291+ * - 'env': set a specific environment to get configuration from
292+ *
293+ * @since __DEPLOY_VERSION__
294+ *
295+ * @return mixed
259296 */
260297 public function runTests ($ opts = ['use-htaccess ' => false , 'env ' => 'desktop ' ])
261298 {
@@ -357,6 +394,8 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
357394 * @param string $pathToTestFile Optional name of the test to be run
358395 * @param string $suite Optional name of the suite containing the tests, Acceptance by default.
359396 *
397+ * @since __DEPLOY_VERSION__
398+ *
360399 * @return mixed
361400 */
362401 public function runTest ($ pathToTestFile = null , $ suite = 'acceptance ' )
@@ -387,7 +426,6 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
387426 if (strripos ($ iterator ->getSubPathName (), 'cept.php ' )
388427 || strripos ($ iterator ->getSubPathName (), 'cest.php ' )
389428 || strripos ($ iterator ->getSubPathName (), '.feature ' ))
390-
391429 {
392430 $ this ->say ('[ ' . $ i . '] ' . $ iterator ->getSubPathName ());
393431 $ tests [$ i ] = $ iterator ->getSubPathName ();
@@ -398,15 +436,15 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
398436 }
399437
400438 $ this ->say ('' );
401- $ testNumber = $ this ->ask ('Type the number of the test in the list that you want to run... ' );
402- $ test = $ tests [$ testNumber ];
439+ $ testNumber = $ this ->ask ('Type the number of the test in the list that you want to run... ' );
440+ $ test = $ tests [$ testNumber ];
403441 }
404442
405443 $ pathToTestFile = $ this ->testsPath . $ suite . '/ ' . $ test ;
406444
407- //loading the class to display the methods in the class
445+ // Loading the class to display the methods in the class
408446
409- //logic to fetch the class name from the file name
447+ // Logic to fetch the class name from the file name
410448 $ fileName = explode ("/ " , $ test );
411449
412450 // If the selected file is cest only then we will give the option to execute individual methods, we don't need this in cept or feature files
@@ -416,7 +454,7 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
416454 {
417455 require $ this ->testsPath . $ suite . '/ ' . $ test ;
418456
419- $ className = explode (". " , $ fileName [1 ]);
457+ $ className = explode (". " , $ fileName [1 ]);
420458 $ class_methods = get_class_methods ($ className [0 ]);
421459 $ this ->say ('[ ' . $ i . '] ' . 'All ' );
422460 $ methods [$ i ] = 'All ' ;
@@ -425,7 +463,8 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
425463 foreach ($ class_methods as $ method_name )
426464 {
427465 $ reflect = new ReflectionMethod ($ className [0 ], $ method_name );
428- if (!$ reflect ->isConstructor ())
466+
467+ if (!$ reflect ->isConstructor ())
429468 {
430469 if ($ reflect ->isPublic ())
431470 {
@@ -435,12 +474,13 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
435474 }
436475 }
437476 }
477+
438478 $ this ->say ('' );
439479 $ methodNumber = $ this ->ask ('Please choose the method in the test that you would want to run... ' );
440- $ method = $ methods [$ methodNumber ];
480+ $ method = $ methods [$ methodNumber ];
441481 }
442482
443- if (isset ($ method ) && $ method != 'All ' )
483+ if (isset ($ method ) && $ method != 'All ' )
444484 {
445485 $ pathToTestFile = $ pathToTestFile . ': ' . $ method ;
446486 }
0 commit comments