Skip to content

Commit 807e59f

Browse files
committed
Tests: test() catches GitException and dumps output & exit code
1 parent 5e82d54 commit 807e59f

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tests/GitPhp/bootstrap.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,24 @@
88

99
function test($cb)
1010
{
11-
$cb();
11+
try {
12+
$cb();
13+
14+
} catch (CzProject\GitPhp\GitException $e) {
15+
$result = $e->getRunnerResult();
16+
17+
if ($result !== NULL) {
18+
echo $result->getCommand(), "\n";
19+
echo 'EXIT CODE: ', $result->getExitCode(), "\n";
20+
echo "--------------\n",
21+
$result->getOutputAsString(), "\n";
22+
23+
if ($result->hasErrorOutput()) {
24+
echo "--------------\n",
25+
implode("\n", $result->getErrorOutput()), "\n";
26+
}
27+
}
28+
29+
throw $e;
30+
}
1231
}

0 commit comments

Comments
 (0)