diff --git a/behat.yml b/behat.yml index ab7450d..0e84fa0 100644 --- a/behat.yml +++ b/behat.yml @@ -1,4 +1,7 @@ default: + autoload: + - "%paths.base%/features/bootstrap" + - "%paths.base%/.mk/features/bootstrap" suites: default: contexts: diff --git a/features/bootstrap/Drumkit/DrumkitContext.php b/features/bootstrap/Drumkit/DrumkitContext.php index 62dc38b..6692c82 100644 --- a/features/bootstrap/Drumkit/DrumkitContext.php +++ b/features/bootstrap/Drumkit/DrumkitContext.php @@ -55,7 +55,10 @@ private function setOrigDir() { } protected function getOutput() { - return $this->process->getOutPut(); + if ($this->process->isSuccessful()) { + return $this->process->getOutput(); + } + return $this->process->getErrorOutput(); } /** @@ -66,15 +69,19 @@ private function exec($command) { $this->process->setTimeout(300); $this->process->run(); - if ($this->debug) { - print_r("--- DEBUG START ---\n"); - print_r($this->getOutput()); - print_r("\n--- DEBUG END -----"); - } + $this->printDebug(); + } + + private function printDebug() { + if (!$this->debug) return; + print_r("--- DEBUG START ---\n"); + print_r($this->getOutput()); + print_r("\n--- DEBUG END -----"); } private function succeed($command) { $this->exec($command); + if (!$this->process->isSuccessful()) { throw new ProcessFailedException($this->process); } @@ -87,7 +94,7 @@ private function fail($command) { $this->exec($command); if ($this->process->isSuccessful()) { - throw new \RuntimeException($this->process->getOutput()); + throw new \RuntimeException($this->getOutput()); } }