passfail(file_exists("admin.sqlite")); testmsg("Testing admin.php saving module orders"); $html = shell_exec("PHP_AUTH_USER=root PHP_AUTH_PW=rachel " . "php -e -r '\$_GET[\"moddirs\"] = \"mod_two,mod_one\"; " . "include \"admin.php\";'"); passfail($html == ""); testmsg("Testing admin.php reading saved module order"); $html = shell_exec("PHP_AUTH_USER=root PHP_AUTH_PW=rachel php admin.php"); passfail(preg_match("/<!DOCTYPE.+mod_two - Test Module 2.+mod_one - Test Module 1.+<\\/html>/s", $html) == 1); testmsg("Testing index.php reading saved module order"); $html = shell_exec("php index.php"); passfail(preg_match("/<!DOCTYPE.+Test Module 2.+Test Module 1.+<\\/html>/s", $html) == 1); testmsg("Testing admin.php hiding both modules"); $html = shell_exec("PHP_AUTH_USER=root PHP_AUTH_PW=rachel " . "php -e -r '\$_GET[\"moddirs\"] = \"mod_one,mod_two\"; " . "\$_GET[\"hidden\"] = \"mod_one,mod_two\"; " . "include \"admin.php\";'"); passfail($html == ""); testmsg("Testing index.php reading all modules hidden"); $html = shell_exec("php index.php"); passfail(preg_match("/<!DOCTYPE.+No modules found.+<\\/html>/s", $html) == 1); if ($fail == 0) { echo "All Tests Passed!\n"; } else { echo "{$pass} test passed, {$fail} tests failed\n"; } cleanup(); function init() { global $fail, $pass, $error; $fail = 0; $pass = 0; $error = 0; rename("modules", "modules.tmp") or error("Couldn't move 'modules' directory\n"); mkdir("modules") or error("Couldn't create 'modules' directory\n"); rename("admin.sqlite", "admin.sqlite.tmp") or error("Couldn't move 'admin.sqlite'\n");
$line = fgets($sum); $feature = strtok($line, " "); $item = strtok(" "); $passes[$item] = 0 + strtok(" "); $fails[$item] = 0 + strtok(" "); } foreach ($sizes as $size) { $style = ""; if ($size == $lastsize) { $style .= "border-right: 1px solid grey;"; } passfail($passes[$size], $fails[$size], $style); } $style = "border-left: 1px solid grey;"; foreach ($vms as $vm) { passfail($passes[$vm], $fails[$vm], $style); $style = ""; } } else { $span = $cols - 1; echo " <td align=\"center\" colspan=\"({$span})\">-- No summary file --</td>\n"; } echo "</tr>\n"; } ?> </table> <!-- END DOCUMENT CONTENT --> </div> </td> </tr> </table>