Prevent undefined errors in TapParser if output from scripts failed.

Closes #515
This commit is contained in:
Tobias van Beek 2014-07-21 13:42:39 +02:00 committed by Dan Cryer
parent 73d5da1c7d
commit 1206f9c2f3

View file

@ -44,7 +44,7 @@ class TapParser
throw new \Exception('TapParser only supports TAP version 13');
}
if (preg_match(self::TEST_COVERAGE_PATTERN, $lines[count($lines) - 1])) {
if (isset($lines[count($lines) - 1]) && preg_match(self::TEST_COVERAGE_PATTERN, $lines[count($lines) - 1])) {
array_pop($lines);
if ($lines[count($lines) - 1] == "") {
array_pop($lines);
@ -58,7 +58,8 @@ class TapParser
$totalTests = (int) $matches[2];
}
if (preg_match(self::TEST_COUNTS_PATTERN, $lines[count($lines) - 1], $matches)) {
if (isset($lines[count($lines) - 1]) &&
preg_match(self::TEST_COUNTS_PATTERN, $lines[count($lines) - 1], $matches)) {
array_pop($lines);
$totalTests = (int) $matches[2];
}