Codeception fixes

This commit is contained in:
Dmitry Khomutov 2017-01-21 11:18:31 +07:00
parent 413230f5fc
commit ff74b2f0c5
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
3 changed files with 21 additions and 8 deletions

View file

@ -156,7 +156,7 @@ class Build extends BuildBase
$reflectedPlugin = new \ReflectionClass($className); $reflectedPlugin = new \ReflectionClass($className);
if (!$reflectedPlugin->implementsInterface('\PHPCensor\ZeroConfigPlugin')) { if (!$reflectedPlugin->implementsInterface('\PHPCensor\ZeroConfigPluginInterface')) {
continue; continue;
} }

View file

@ -38,9 +38,12 @@ class Codeception extends Plugin implements ZeroConfigPluginInterface
protected $ymlConfigFile; protected $ymlConfigFile;
/** /**
* @var string $path The path to the codeception tests folder. * @var array $path The path to the codeception tests folder.
*/ */
protected $path; protected $path = [
'tests/_output',
'tests/_log',
];
/** /**
* @return string * @return string
@ -57,8 +60,6 @@ class Codeception extends Plugin implements ZeroConfigPluginInterface
{ {
parent::__construct($builder, $build, $options); parent::__construct($builder, $build, $options);
$this->path = 'tests' . DIRECTORY_SEPARATOR . '_output' . DIRECTORY_SEPARATOR;
if (empty($options['config'])) { if (empty($options['config'])) {
$this->ymlConfigFile = self::findConfigFile($this->builder->buildPath); $this->ymlConfigFile = self::findConfigFile($this->builder->buildPath);
} else { } else {
@ -140,11 +141,21 @@ class Codeception extends Plugin implements ZeroConfigPluginInterface
$yaml = file_get_contents($configPath); $yaml = file_get_contents($configPath);
$config = (array)$parser->parse($yaml); $config = (array)$parser->parse($yaml);
$outputPath = null;
if ($config && isset($config['paths']['log'])) { if ($config && isset($config['paths']['log'])) {
$this->path = $config['paths']['log'] . DIRECTORY_SEPARATOR; $outputPath = $this->builder->buildPath . $config['paths']['log'] . '/';
}
if (!file_exists($outputPath . 'report.xml')) {
foreach ($this->path as $path) {
$outputPath = $this->builder->buildPath . $path . '/';
if (file_exists($outputPath . 'report.xml')) {
break;
}
}
} }
$xml = file_get_contents($this->builder->buildPath . $this->path . 'report.xml', false); $xml = file_get_contents($outputPath . 'report.xml', false);
$parser = new Parser($this->builder, $xml); $parser = new Parser($this->builder, $xml);
$output = $parser->parse(); $output = $parser->parse();

View file

@ -43,8 +43,10 @@ class Executor
/** /**
* Execute a the appropriate set of plugins for a given build stage. * Execute a the appropriate set of plugins for a given build stage.
* @param array $config PHPCI configuration *
* @param array $config PHPCI configuration
* @param string $stage * @param string $stage
*
* @return bool * @return bool
*/ */
public function executePlugins(&$config, $stage) public function executePlugins(&$config, $stage)