diff --git a/src/TUnit/framework/reporting/CoverageReporter.php b/src/TUnit/framework/reporting/CoverageReporter.php index 98a0723..585ed80 100644 --- a/src/TUnit/framework/reporting/CoverageReporter.php +++ b/src/TUnit/framework/reporting/CoverageReporter.php @@ -264,7 +264,7 @@ foreach ($coverageData as $file => $data) { $dirs = preg_split('@\\' . DIRECTORY_SEPARATOR . '@', str_replace($baseDir, '', dirname($file) . DIRECTORY_SEPARATOR), -1, PREG_SPLIT_NO_EMPTY); if (empty($dirs)) { - continue; + $dirs[] = ''; } $loc = count($data); @@ -303,7 +303,7 @@ $link = ''; $subdirs = array(); foreach ($dirData as $dir2 => $data2) { - if (substr($dir2, 0, strrpos($dir2, DIRECTORY_SEPARATOR)) === $dir) { + if ($dir === DIRECTORY_SEPARATOR || substr($dir2, 0, strrpos($dir2, DIRECTORY_SEPARATOR)) === $dir) { //this is a direct subdirectory $subdirs[] = $dir2; } @@ -313,6 +313,9 @@ //create directory info foreach ($subdirs as $subdir) { + if ($subdir === DIRECTORY_SEPARATOR) { + continue; + } $subdata = $dirData[$subdir]; $info .= '