Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 31 additions & 23 deletions RoboFile.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<?php
/**
* This is joomla project's console command file for Robo.li task runner.
*
* Download robo.phar from http://robo.li/robo.phar and type in the root of the repo: $ php robo.phar
* Or do: $ composer update, and afterwards you will be able to execute robo like $ php libraries/vendor/bin/robo
*
* @package Joomla.Site
* @subpackage RoboFile
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

/**
* This is joomla project's console command file for Robo.li task runner.
*
* Download robo.phar from http://robo.li/robo.phar and type in the root of the repo: $ php robo.phar
* Or do: $ composer update, and afterwards you will be able to execute robo like $ php libraries/vendor/bin/robo
*
* @see http://robo.li/
*/
require_once __DIR__ . '/tests/codeception/vendor/autoload.php';
Expand Down Expand Up @@ -58,13 +61,14 @@ class RoboFile extends \Robo\Tasks
/**
* RoboFile constructor.
*
* @since __DEPLOY_VERSION__
* @since __DEPLOY_VERSION__
*
* @return void
*/
public function __construct()
{
$this->configuration = $this->getConfiguration();

$this->cmsPath = $this->getTestingPath();
$this->cmsPath = $this->getTestingPath();

// Set default timezone (so no warnings are generated if it is not set)
date_default_timezone_set('UTC');
Expand All @@ -73,9 +77,9 @@ public function __construct()
/**
* Get (optional) configuration from an external file
*
* @since __DEPLOY_VERSION__
* @since __DEPLOY_VERSION__
*
* @return \stdClass|null
* @return \stdClass|null
*/
public function getConfiguration()
{
Expand Down Expand Up @@ -103,9 +107,9 @@ public function getConfiguration()
/**
* Get the correct CMS root path
*
* @since __DEPLOY_VERSION__
* @since __DEPLOY_VERSION__
*
* @return string
* @return string
*/
private function getTestingPath()
{
Expand All @@ -116,7 +120,7 @@ private function getTestingPath()

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

return $this->testsPath . 'joomla-cms3';
}
Expand All @@ -129,7 +133,7 @@ private function getTestingPath()
*
* @since __DEPLOY_VERSION__
*
* @return bool
* @return bool This is allways true
*/
public function build()
{
Expand All @@ -139,13 +143,13 @@ public function build()
/**
* Creates a testing Joomla site for running the tests (use it before run:test)
*
* @param bool $use_htaccess (1/0) Rename and enable embedded Joomla .htaccess file
* @param bool $useHtaccess (1/0) Rename and enable embedded Joomla .htaccess file
*
* @since __DEPLOY_VERSION__
*
* @return void
*/
public function createTestingSite($use_htaccess = false)
public function createTestingSite($useHtaccess = false)
{
// Clean old testing site
if (is_dir($this->cmsPath))
Expand All @@ -157,7 +161,8 @@ public function createTestingSite($use_htaccess = false)
catch (Exception $e)
{
// Sorry, we tried :(
$this->say('Sorry, you will have to delete ' . $this->cmsPath . ' manually. ');
$this->say('Sorry, you will have to delete ' . $this->cmsPath . ' manually.');

exit(1);
}
}
Expand All @@ -175,7 +180,7 @@ public function createTestingSite($use_htaccess = false)
}

// Optionally uses Joomla default htaccess file. Used by TravisCI
if ($use_htaccess == true)
if ($useHtaccess == true)
{
$this->say("Renaming htaccess.txt to .htaccess");
$this->_copy('./htaccess.txt', $this->cmsPath . '/.htaccess');
Expand Down Expand Up @@ -242,7 +247,7 @@ protected function copyJoomla($dst, $exclude = array())
*
* @since __DEPLOY_VERSION__
*
* @return void
* @return void
*/
private function getComposer()
{
Expand Down Expand Up @@ -387,7 +392,6 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
*/
}


/**
* Executes a specific Selenium System Tests in your machine
*
Expand Down Expand Up @@ -418,8 +422,9 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
);

$tests = array();
$i = 1;

$iterator->rewind();
$i = 1;

while ($iterator->valid())
{
Expand All @@ -428,6 +433,7 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
|| strripos($iterator->getSubPathName(), '.feature'))
{
$this->say('[' . $i . '] ' . $iterator->getSubPathName());

$tests[$i] = $iterator->getSubPathName();
$i++;
}
Expand All @@ -436,7 +442,7 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
}

$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...');
$test = $tests[$testNumber];
}

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

$className = explode(".", $fileName[1]);
$class_methods = get_class_methods($className[0]);

$this->say('[' . $i . '] ' . 'All');

$methods[$i] = 'All';
$i++;

Expand All @@ -467,7 +475,7 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
if (!$reflect->isConstructor() && $reflect->isPublic())
{
$this->say('[' . $i . '] ' . $method_name);

$methods[$i] = $method_name;

$i++;
Expand Down