Refactored plugins
This commit is contained in:
parent
1a3a0a1993
commit
16a5add859
45 changed files with 404 additions and 1224 deletions
|
|
@ -25,17 +25,11 @@ use PHPCensor\ZeroConfigPlugin;
|
|||
* @package PHPCI
|
||||
* @subpackage Plugins
|
||||
*/
|
||||
class Codeception implements Plugin, ZeroConfigPlugin
|
||||
class Codeception extends Plugin implements ZeroConfigPlugin
|
||||
{
|
||||
/** @var string */
|
||||
protected $args = '';
|
||||
|
||||
/** @var Builder */
|
||||
protected $phpci;
|
||||
|
||||
/** @var Build */
|
||||
protected $build;
|
||||
|
||||
/**
|
||||
* @var string $ymlConfigFile The path of a yml config for Codeception
|
||||
*/
|
||||
|
|
@ -46,6 +40,28 @@ class Codeception implements Plugin, ZeroConfigPlugin
|
|||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(Builder $phpci, Build $build, array $options = [])
|
||||
{
|
||||
parent::__construct($phpci, $build, $options);
|
||||
|
||||
$this->path = 'tests' . DIRECTORY_SEPARATOR . '_output' . DIRECTORY_SEPARATOR;
|
||||
|
||||
if (empty($options['config'])) {
|
||||
$this->ymlConfigFile = self::findConfigFile($this->phpci->buildPath);
|
||||
} else {
|
||||
$this->ymlConfigFile = $options['config'];
|
||||
}
|
||||
if (isset($options['args'])) {
|
||||
$this->args = (string) $options['args'];
|
||||
}
|
||||
if (isset($options['path'])) {
|
||||
$this->path = $options['path'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $stage
|
||||
* @param Builder $builder
|
||||
|
|
@ -75,33 +91,6 @@ class Codeception implements Plugin, ZeroConfigPlugin
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the plugin, configure options, etc.
|
||||
* @param Builder $phpci
|
||||
* @param Build $build
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(Builder $phpci, Build $build, array $options = [])
|
||||
{
|
||||
$this->phpci = $phpci;
|
||||
$this->build = $build;
|
||||
$this->path = 'tests' . DIRECTORY_SEPARATOR . '_output' . DIRECTORY_SEPARATOR;
|
||||
|
||||
if (empty($options['config'])) {
|
||||
$this->ymlConfigFile = self::findConfigFile($this->phpci->buildPath);
|
||||
} else {
|
||||
$this->ymlConfigFile = $options['config'];
|
||||
}
|
||||
if (isset($options['args'])) {
|
||||
$this->args = (string) $options['args'];
|
||||
}
|
||||
if (isset($options['path'])) {
|
||||
$this->path = $options['path'];
|
||||
}
|
||||
|
||||
$this->phpci->logDebug('Plugin options: ' . json_encode($options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs Codeception tests
|
||||
*/
|
||||
|
|
@ -125,18 +114,18 @@ class Codeception implements Plugin, ZeroConfigPlugin
|
|||
{
|
||||
$this->phpci->logExecOutput(false);
|
||||
|
||||
$codecept = $this->phpci->findBinary('codecept');
|
||||
$codeception = $this->phpci->findBinary('codecept');
|
||||
|
||||
if (!$codecept) {
|
||||
if (!$codeception) {
|
||||
$this->phpci->logFailure(Lang::get('could_not_find', 'codecept'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmd = 'cd "%s" && ' . $codecept . ' run -c "%s" --xml ' . $this->args;
|
||||
$cmd = 'cd "%s" && ' . $codeception . ' run -c "%s" --xml ' . $this->args;
|
||||
|
||||
if (IS_WIN) {
|
||||
$cmd = 'cd /d "%s" && ' . $codecept . ' run -c "%s" --xml ' . $this->args;
|
||||
$cmd = 'cd /d "%s" && ' . $codeception . ' run -c "%s" --xml ' . $this->args;
|
||||
}
|
||||
|
||||
$configPath = $this->phpci->buildPath . $configPath;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue