]> git.joonet.de Git - adminer.git/commitdiff
Code coverage
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 2 Oct 2008 22:10:34 +0000 (22:10 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 2 Oct 2008 22:10:34 +0000 (22:10 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@515 7c3ca157-0c34-0410-bff1-cbf682f78f5c

_coverage.php
tests/15-privileges.html
tests/coverage.html [deleted file]
tests/logout.html [new file with mode: 0644]
tests/selenium.html

index 3c0dd65a47f65892fd0c16dfccec0dd5f5ee96a6..6e762b8b3b79557320bdd5a00298f7e6398acf57 100644 (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>
index 5ec8e2aee2297ce9cc4a047903e29502827d63cb..75f394b3565e8f08ceef9e2fba9a929b5243525d 100644 (file)
        <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>
diff --git a/tests/coverage.html b/tests/coverage.html
deleted file mode 100644 (file)
index 512dd02..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<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>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">Coverage</td></tr>
-</thead><tbody>
-<tr>
-       <td>open</td>
-       <td>/phpMinAdmin/_coverage.php</td>
-       <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/tests/logout.html b/tests/logout.html
new file mode 100644 (file)
index 0000000..5d51178
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<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>Logout</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<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>
+
+</tbody></table>
+</body>
+</html>
index de22c03c8cee59d5a64a32dbe89ae8fea8435c04..57d5f552b1749978e0d94f75331401ec4a9bfdf3 100644 (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>