From 2c567bebff6d01919771ccf68f92d368555ee82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Monta=C3=B1ez?= Date: Tue, 10 Jan 2017 21:48:38 -0300 Subject: [PATCH] [Nostromo] Test coverage --- src/Command/BuiltIn/DeployCommand.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Command/BuiltIn/DeployCommand.php b/src/Command/BuiltIn/DeployCommand.php index 72d7438..3091171 100644 --- a/src/Command/BuiltIn/DeployCommand.php +++ b/src/Command/BuiltIn/DeployCommand.php @@ -116,7 +116,7 @@ class DeployCommand extends AbstractCommand // Run "Pre Deploy" Tasks $this->runtime->setStage(Runtime::PRE_DEPLOY); if (!$this->runTasks($output, $strategy->getPreDeployTasks())) { - $this->halt(); + throw $this->getException(); } // Run "On Deploy" Tasks @@ -134,7 +134,7 @@ class DeployCommand extends AbstractCommand // Run "Post Deploy" Tasks $this->runtime->setStage(Runtime::POST_DEPLOY); if (!$this->runTasks($output, $strategy->getPostDeployTasks())) { - $this->halt(); + throw $this->getException(); } } @@ -149,7 +149,7 @@ class DeployCommand extends AbstractCommand $this->runtime->setWorkingHost($host); if (!$this->runTasks($output, $tasks)) { $this->runtime->setWorkingHost(null); - $this->halt(); + throw $this->getException(); } $this->runtime->setWorkingHost(null); } @@ -231,12 +231,10 @@ class DeployCommand extends AbstractCommand } /** - * Halts the current process - * - * @throws RuntimeException + * Exception for halting the the current process */ - protected function halt() + protected function getException() { - throw new RuntimeException(sprintf('Stage "%s" did not finished successfully, halting command.', $this->getStageName()), 50); + return new RuntimeException(sprintf('Stage "%s" did not finished successfully, halting command.', $this->getStageName()), 50); } }