From 8e3bca497241a9a66c38078af97ba2d0feac348f Mon Sep 17 00:00:00 2001 From: Scott Dutton Date: Tue, 7 Feb 2017 13:29:15 +0000 Subject: [PATCH] Only show missed lines when there are missed lines --- functions.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/functions.php b/functions.php index 430cff1..22947c5 100644 --- a/functions.php +++ b/functions.php @@ -73,8 +73,16 @@ function handleOutput($lines, $minimumPercentCovered) $percentCovered = 100 * ($coveredLines / ($coveredLines + $uncoveredLines)); - echo "$percentCovered% Covered, Missed lines " . PHP_EOL; - print_r($lines['uncoveredLines']); + $extra = PHP_EOL; + + if ($lines['uncoveredLines']) { + $extra = ', Missed lines '. + $extra . + print_r($lines['uncoveredLines'], true) + ; + } + + printf('%.2f% Covered%s', $percentCovered, $extra); if ($percentCovered >= $minimumPercentCovered) { exit(0);