Implemented Atoum plugin as a 'native' plugin:
- allow atoum bin to be called directly into PHPCI and not only in the current project tested (changed -d option), - added plugin in the phpci's composer.json, - modify execute method of the plugin because atoum always return 0 even if errors are catched,
This commit is contained in:
parent
e77a5a75fb
commit
2bfd226663
|
@ -7,7 +7,6 @@ class Atoum implements \PHPCI\Plugin
|
|||
private $args;
|
||||
private $config;
|
||||
private $directory;
|
||||
private $executable;
|
||||
|
||||
public function __construct(\PHPCI\Builder $phpci, array $options = array())
|
||||
{
|
||||
|
@ -17,7 +16,7 @@ class Atoum implements \PHPCI\Plugin
|
|||
$this->executable = $options['executable'];
|
||||
}
|
||||
else {
|
||||
$this->executable = './vendor/bin/atoum';
|
||||
$this->executable = PHPCI_BIN_DIR.'atoum';
|
||||
}
|
||||
|
||||
if (isset($options['args'])) {
|
||||
|
@ -35,7 +34,7 @@ class Atoum implements \PHPCI\Plugin
|
|||
|
||||
public function execute()
|
||||
{
|
||||
$cmd = $this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->executable;
|
||||
$cmd = $this->executable;
|
||||
|
||||
if ($this->args !== null) {
|
||||
$cmd .= " {$this->args}";
|
||||
|
@ -44,8 +43,19 @@ class Atoum implements \PHPCI\Plugin
|
|||
$cmd .= " -c '{$this->config}'";
|
||||
}
|
||||
if ($this->directory !== null) {
|
||||
$cmd .= " -d '{$this->directory}'";
|
||||
$dirPath = $this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->directory;
|
||||
$cmd .= " -d '{$dirPath}'";
|
||||
}
|
||||
return $this->phpci->executeCommand($cmd);
|
||||
|
||||
$output = '';
|
||||
$status = true;
|
||||
exec($cmd, $output);
|
||||
|
||||
if (!empty($output) && count(preg_grep("/error/i",$output)) > 0) {
|
||||
$status = false;
|
||||
$this->phpci->log($output, ' ');
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
"symfony/yaml" : "2.2.x-dev",
|
||||
"symfony/console" : "2.2.*",
|
||||
"fabpot/php-cs-fixer" : "0.3.*@dev",
|
||||
"swiftmailer/swiftmailer" : "v5.0.0"
|
||||
"swiftmailer/swiftmailer" : "v5.0.0",
|
||||
"atoum/atoum":"*"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue