Skip to content
Browse files

Code coverage

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@515 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent bb1ae0b commit af4fbca33a5158d45e768aebdf027300674a32f9 jakubvrana committed
Showing with 37 additions and 14 deletions.
  1. +19 −7 _coverage.php
  2. +0 −5 tests/15-privileges.html
  3. +17 −2 tests/{coverage.html → logout.html}
  4. +1 −0 tests/selenium.html
View
26 _coverage.php
@@ -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 @@ function xhtml_open_tags($s) {
}
$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
5 tests/15-privileges.html
@@ -78,11 +78,6 @@
</tr>
<tr>
<td>click</td>
- <td>grants[0][TRIGGER]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
<td>grants[0][UPDATE]</td>
<td></td>
</tr>
View
19 tests/coverage.html → tests/logout.html
@@ -4,15 +4,30 @@
<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>
<td></td>
</tr>
View
1 tests/selenium.html
@@ -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>

0 comments on commit af4fbca

Please sign in to comment.
Something went wrong with that request. Please try again.