Code coverage

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@515 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2008-10-02 22:10:34 +00:00
parent bb1ae0ba54
commit af4fbca33a
4 changed files with 37 additions and 14 deletions

View file

@ -19,11 +19,16 @@ function xhtml_open_tags($s) {
return $return;
}
if (!extension_loaded("xdebug")) {
echo "<p>Xdebug has to be enabled.</p>\n";
}
if ($_GET["start"]) {
$_SESSION["coverage"] = array();
header("Location: .");
exit;
} elseif ($_GET["filename"]) {
}
if ($_GET["filename"]) {
$filename = basename($_GET["filename"]);
$coverage = $_SESSION["coverage"][realpath($filename)];
$file = explode("<br />", highlight_file($filename, true));
@ -52,15 +57,22 @@ if ($_GET["start"]) {
}
$s .= "$line<br />\n";
}
} elseif (isset($_SESSION["coverage"])) {
echo "<ul>\n";
} else {
echo "<table border='0' cellspacing='0' cellpadding='1'>\n";
foreach (glob("*.php") as $filename) {
if ($filename{0} != "_") {
$coverage = $_SESSION["coverage"][realpath($filename)];
echo "<li><a href='_coverage.php?filename=$filename'>$filename</a> (" . (isset($coverage) ? "tested" : "untested") . ")</li>\n";
echo "<tr><td align='right' style='background-color: ";
if (isset($coverage)) {
$values = array_count_values($coverage);
$ratio = $values[-1] / count($coverage);
echo ($ratio ? "Silver" : "#C0FFC0") . ";'>" . round(100 - 100 * $ratio);
} else {
echo "#FFC0C0;'>0";
}
echo "%</td><td><a href='_coverage.php?filename=$filename'>$filename</a></td></tr>\n";
}
}
echo "</ul>\n";
echo "</table>\n";
echo "<p><a href='_coverage.php?start=1'>Start new coverage</a> (requires <a href='http://www.xdebug.org'>Xdebug</a>)</p>\n";
}
?>
<p><a href="_coverage.php?start=1">Start new coverage</a> (requires <a href="http://www.xdebug.org">Xdebug</a>)</p>

View file

@ -76,11 +76,6 @@
<td>//input[@name='grants[0][SHOW VIEW]']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>grants[0][TRIGGER]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>grants[0][UPDATE]</td>

View file

@ -4,13 +4,28 @@
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>Coverage</title>
<title>Logout</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Coverage</td></tr>
<tr><td rowspan="1" colspan="3">Logout</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/phpMinAdmin/</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>logout</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Logout successful.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>/phpMinAdmin/_coverage.php</td>

View file

@ -27,6 +27,7 @@
<tr><td><a href="16-processlist.html">Process list</a></td></tr>
<tr><td><a href="17-export.html">Export</a></td></tr>
<tr><td><a href="18-events.html">Events</a></td></tr>
<tr><td><a href="logout.html">Logout</a></td></tr>
</tbody></table>
</body>
</html>