mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-06-07 08:50:49 +00:00
Updating Robo File to add the functionality to run each method.
This commit is contained in:
parent
b1c3dee301
commit
3902ca6332
60
RoboFile.php
60
RoboFile.php
|
@ -155,12 +155,70 @@ class RoboFile extends \Robo\Tasks
|
||||||
|
|
||||||
$pathToTestFile = 'tests/' . $suite . '/' . $test;
|
$pathToTestFile = 'tests/' . $suite . '/' . $test;
|
||||||
|
|
||||||
$this->taskCodecept()
|
//loading the class to display the methods in the class
|
||||||
|
require 'tests/' . $suite . '/' . $test;
|
||||||
|
|
||||||
|
//logic to fetch the class name from the file name
|
||||||
|
$fileName = explode("/", $test);
|
||||||
|
$className = explode(".", $fileName[1]);
|
||||||
|
|
||||||
|
//if the selected file is cest only than we will give the option to execute individual methods, we don't need this in cept file
|
||||||
|
$i = 1;
|
||||||
|
if (strripos($className[0], 'cest'))
|
||||||
|
{
|
||||||
|
$class_methods = get_class_methods($className[0]);
|
||||||
|
$this->say('[' . $i . '] ' . 'All');
|
||||||
|
$methods[$i] = 'All';
|
||||||
|
$i++;
|
||||||
|
foreach ($class_methods as $method_name)
|
||||||
|
{
|
||||||
|
|
||||||
|
$reflect = new ReflectionMethod($className[0], $method_name);
|
||||||
|
if(!$reflect->isConstructor())
|
||||||
|
{
|
||||||
|
if ($reflect->isPublic())
|
||||||
|
{
|
||||||
|
$this->say('[' . $i . '] ' . $method_name);
|
||||||
|
$methods[$i] = $method_name;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->say('');
|
||||||
|
$methodNumber = $this->ask('Please choose the method in the test that you would want to run...');
|
||||||
|
$method = $methods[$methodNumber];
|
||||||
|
}
|
||||||
|
if(isset($method))
|
||||||
|
{
|
||||||
|
if($method != 'All')
|
||||||
|
{
|
||||||
|
$this->taskCodecept()
|
||||||
|
->test($pathToTestFile . ':' . $method)
|
||||||
|
->arg('--steps')
|
||||||
|
->arg('--debug')
|
||||||
|
->run()
|
||||||
|
->stopOnFail();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->taskCodecept()
|
||||||
|
->test($pathToTestFile)
|
||||||
|
->arg('--steps')
|
||||||
|
->arg('--debug')
|
||||||
|
->run()
|
||||||
|
->stopOnFail();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->taskCodecept()
|
||||||
->test($pathToTestFile)
|
->test($pathToTestFile)
|
||||||
->arg('--steps')
|
->arg('--steps')
|
||||||
->arg('--debug')
|
->arg('--debug')
|
||||||
->run()
|
->run()
|
||||||
->stopOnFail();
|
->stopOnFail();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user