]> BookStack Code Mirror - system-cli/blobdiff - tests/CommandResult.php
Started testing of backup command
[system-cli] / tests / CommandResult.php
index 492e216e3022dcbf054eb4a57f768502e4613933..011f02226238ae2d7556f343175139e313d9e2a5 100644 (file)
@@ -20,7 +20,21 @@ class CommandResult
 
     public function assertSuccessfulExit(): void
     {
-        Assert::assertEquals(0, $this->tester->getStatusCode());
+        try {
+            $statusCode = $this->tester->getStatusCode();
+        } catch (\Exception $exception) {
+            $statusCode = 1;
+        }
+
+        Assert::assertEquals(0, $statusCode);
+    }
+
+    public function dumpError(): void
+    {
+        if ($this->error) {
+            echo $this->error->getMessage() . "\n" .
+                $this->error->getTraceAsString();
+        }
     }
 
     public function assertErrorExit(): void