Skip to content

Commit

Permalink
fixes 127 - bug with failure-condition option
Browse files Browse the repository at this point in the history
  • Loading branch information
Halleck45 committed Apr 1, 2015
1 parent a3f8fd1 commit d19b81b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/Hal/Application/Command/RunMetricsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
// evaluation of success
$evaluator = new Evaluator($collection, $aggregatedResults, $bounds);
$result = $evaluator->evaluate($config->getFailureCondition());
return $result->getCode();
// fail if failure-condition is realized
return $result->isValid() ? 1 : 0;
}

}
1 change: 1 addition & 0 deletions src/Hal/Application/Config/ConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function factory(InputInterface $input) {
strlen($input->getOption('report-csv')) > 0 && $config->getLogging()->setReport('csv', $input->getOption('report-csv'));
strlen($input->getOption('violations-xml')) > 0 && $config->getLogging()->setViolation('xml', $input->getOption('violations-xml'));
strlen($input->getOption('chart-bubbles')) > 0 && $config->getLogging()->setChart('bubbles', $input->getOption('chart-bubbles'));
strlen($input->getOption('failure-condition')) > 0 && $config->setFailureCondition($input->getOption('failure-condition'));

return $config;

Expand Down
8 changes: 0 additions & 8 deletions src/Hal/Component/Evaluation/Evaluation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ class Evaluation

private $valid = true;

/**
* @return int
*/
public function getCode()
{
return $this->valid === true ? 0 : 1;
}

/**
* @param boolean $valid
* @return $this
Expand Down

0 comments on commit d19b81b

Please sign in to comment.