1
0
mirror of synced 2025-01-29 19:41:45 +03:00

Preliminary graphical coverage report. If you want to play please replace all

paths with your absolute path to doctrine in the coverage.txt file and change
the path in coverage.php

Very very beta.
This commit is contained in:
meus 2007-07-23 21:36:20 +00:00
parent b5f81c5153
commit 6b1c61965b
2 changed files with 61 additions and 0 deletions

60
tests/coverage.php Normal file
View File

@ -0,0 +1,60 @@
<?php
// include doctrine, and register it's autoloader
require_once dirname(__FILE__) . '/../lib/Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));
$path = "/home/bjartka/workspace/doctrine/lib/";
?>
<html>
<head>
<style type="text/css">
.covered{ background: #eee;}
</style>
</head>
<body>
<?
function getCoverageReport($file){
$coverage = unserialize(file_get_contents("coverage.txt"));
$html = '<div id="coverage">';
if(!isset($coverage[$file])){
$html .= 'No coverage for this file</div>';
return $html;
}
$coveredLines = $coverage[$file];
$fileArray = file($file);
$html .= '<dl class="filelist">' . "\n";
foreach($fileArray as $num => $line){
$linenum = $num+1;
$html .= '<dt>' . $linenum . '</dt>' . "\n";
$class ="normal";
if(isset($coveredLines[$linenum]) && $coveredLines[$linenum] == 1){
$class = "covered";
}
$html .= '<dd class="' . $class . '">' . htmlspecialchars($line) . '</dd>' . "\n";
}
$html .='</dl></div>';
return $html;
}
if(isset($_GET["file"])){
$file = $_GET["file"];
echo '<a href="coverage.php">Back to filelist</a>';
echo '<h1>Coverage for ' . $file . '</h1>';
echo getCoverageReport($file);
}else{
echo "<ul>";
$it = new RecursiveDirectoryIterator($path);
foreach(new RecursiveIteratorIterator($it) as $file){
if(strpos($file->getPathname(), ".svn")){
continue;
}
echo '<li><a href="?file=' . $file->getPathname() . '">' . $file->getPathname() . '</a></li>';
}
}
?>
</body>
</html>

1
tests/coverage.txt Executable file

File diff suppressed because one or more lines are too long