fixed bug where index.html of coverage report wasn't being generated

This commit is contained in:
tmont 2009-07-02 06:41:02 +00:00
parent fbf9f84520
commit 88a0142808

View File

@ -286,12 +286,15 @@
return file_put_contents($newFile, $template); return file_put_contents($newFile, $template);
} }
/**
* @todo If there are no files in the root directory (e.g. only directories)
* then index.html does not get generated
*/
private static function writeHtmlDirectories($coverageDir, $baseDir, array $coverageData, $renderer) { private static function writeHtmlDirectories($coverageDir, $baseDir, array $coverageData, $renderer) {
$dirData = array(); //set up root directory
$dirData[DIRECTORY_SEPARATOR] = array(
'loc' => 0,
'dloc' => 0,
'cloc' => 0,
'files' => array()
);
foreach ($coverageData as $file => $data) { foreach ($coverageData as $file => $data) {
$dirs = preg_split('@\\' . DIRECTORY_SEPARATOR . '@', str_replace($baseDir, '', dirname($file) . DIRECTORY_SEPARATOR), -1, PREG_SPLIT_NO_EMPTY); $dirs = preg_split('@\\' . DIRECTORY_SEPARATOR . '@', str_replace($baseDir, '', dirname($file) . DIRECTORY_SEPARATOR), -1, PREG_SPLIT_NO_EMPTY);
if (empty($dirs)) { if (empty($dirs)) {