From 6a32cfb0439525ee50b4191e7a288985186a4d09 Mon Sep 17 00:00:00 2001 From: SimonHeimberg Date: Sat, 22 Jul 2017 19:05:12 +0200 Subject: [PATCH 1/2] valid init value for config of builder, to not fail pluginExecutor when setupBuild failed --- src/PHPCensor/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PHPCensor/Builder.php b/src/PHPCensor/Builder.php index ac073f71..a666828b 100644 --- a/src/PHPCensor/Builder.php +++ b/src/PHPCensor/Builder.php @@ -52,7 +52,7 @@ class Builder implements LoggerAwareInterface /** * @var array */ - protected $config; + protected $config = []; /** * @var string From ffce3e31e7e0d3cd69f8c95077b6d27672f1110e Mon Sep 17 00:00:00 2001 From: SimonHeimberg Date: Sat, 22 Jul 2017 19:05:28 +0200 Subject: [PATCH 2/2] plugins depending on tests success state run also on exception Failure notification on an exception seems important. Now failures in this plugins will not count for build state. --- src/PHPCensor/Builder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PHPCensor/Builder.php b/src/PHPCensor/Builder.php index a666828b..37e8496e 100644 --- a/src/PHPCensor/Builder.php +++ b/src/PHPCensor/Builder.php @@ -217,7 +217,13 @@ class Builder implements LoggerAwareInterface } else { $this->build->setStatus(Build::STATUS_FAILED); } + } catch (\Exception $ex) { + $success = false; + $this->build->setStatus(Build::STATUS_FAILED); + $this->buildLogger->logFailure('Exception: ' . $ex->getMessage(), $ex); + } + try { if ($success) { $this->pluginExecutor->executePlugins($this->config, Build::STAGE_SUCCESS); @@ -232,7 +238,6 @@ class Builder implements LoggerAwareInterface } } } catch (\Exception $ex) { - $this->build->setStatus(Build::STATUS_FAILED); $this->buildLogger->logFailure('Exception: ' . $ex->getMessage(), $ex); }