GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
sqlmarker
Browse code
Tweaked the HTML output and added a message key to the results page.
master
1 parent
26d9482
commit
62e7ab512e239e7de81f9c0689c6365e6c2f4d07
Nigel Stanger
authored
on 27 Jul 2013
Patch
Showing
2 changed files
Unit_testing/Reporter/HTMLReporter.php
Unit_testing/check_minimum_requirement.php
Ignore Space
Show notes
View
Unit_testing/Reporter/HTMLReporter.php
<?php require_once 'Reporter.php'; class HTMLReporter extends Reporter { public function report( $status, $reportText, $printfArguments ) { if ( $this->getVerbosity() ) { $statusText = '<p class="blackboard'; switch ( $status ) { case Reporter::STATUS_PASS: $statusText .= ' greenbg result"><span style="font-size: large">✔</span> '; break; case Reporter::STATUS_SKIPPED: $statusText .= '" style="padding-left: 2em;"><strong style="font-size: large">#</strong> '; break; case Reporter::STATUS_INCOMPLETE: $statusText .= ' uniyellbg result"><strong style="font-size: large">%</strong> '; break; case Reporter::STATUS_FAILURE: $statusText .= ' uniredbg result""><span style="font-size: large">✘</span> '; break; case Reporter::STATUS_ERROR: $statusText .= ' uniredbg result"><span style="font-size: large">☠</span> '; break; case Reporter::STATUS_WARNING: $statusText .= ' uniyellbg result"><span style="font-size: large">⚠</span> '; break; case Reporter::STATUS_NOTE: $statusText .= ' grey-light result">'; break; default: case Reporter::STATUS_TEST: $statusText .= ' style="font-weight: bold;">'; break; default: $statusText .= ' uniyellbg result"><strong style="font-size: large">?</strong> '; break; } if ( $this->getVerbosity() > 1 ) $statusText .= "<strong>" . ucfirst( strtolower( $status ) ) . ':</strong> '; parent::report( $statusText, $reportText . "</span></p>\n", $printfArguments ); } } public function hr() { echo "<hr />\n"; } } ?>
<?php require_once 'Reporter.php'; class HTMLReporter extends Reporter { public function report( $status, $reportText, $printfArguments ) { if ( $this->getVerbosity() ) { $statusText = '<p class="blackboard"><span'; switch ( $status ) { case Reporter::STATUS_PASS: $statusText .= ' style="color: green;">✔ '; break; case Reporter::STATUS_SKIPPED: $statusText .= ' style="padding-left: 2em;"># '; break; case Reporter::STATUS_INCOMPLETE: $statusText .= ' style="background-color: yellow;">% '; break; case Reporter::STATUS_FAILURE: $statusText .= ' style="color: red;">✘ '; break; case Reporter::STATUS_ERROR: $statusText .= ' style="color: red;">☠ '; break; case Reporter::STATUS_WARNING: $statusText .= ' style="color: orange;">⚠ '; break; case Reporter::STATUS_NOTE: $statusText .= ' style="background-color: lightgrey;">'; break; default: case Reporter::STATUS_TEST: $statusText .= ' style="font-weight: bold;">'; break; default: $statusText .= ' style="background-color: yellow;">? '; break; } if ( $this->getVerbosity() > 1 ) $statusText .= "<strong>" . ucfirst( strtolower( $status ) ) . ':</strong> '; parent::report( $statusText, $reportText . "</span></p>\n", $printfArguments ); } } public function hr() { echo "<hr />\n"; } } ?>
Ignore Space
Show notes
View
Unit_testing/check_minimum_requirement.php
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>INFO 214 Assignment 1 Minimum Requirement Tester: Results</title> <meta name="generator" content="BBEdit 9.6" /> <link rel="Stylesheet" href="https://blackboard.otago.ac.nz/bbcswebdav/courses/INFO321_S2DNS_2013/db_styles.css" type="text/css" /> <style type="text/css" media="screen"> .greenbg { background-color: green; color: white; } .result { padding: 8px; } </style> </head> <body> <h1>INFO 214 Assignment 1 Minimum Requirement Tester: Results</h1> <h2>Key</h2> <table> <tr> <td class="blackboard grey-light result"><strong>Note:</strong> These messagesa are just for information.</td> <td class="blackboard yellow-ou result"><strong style="font-size: large">%</strong> <strong>Incomplete:</strong> A test was not completed. It may or may not be a problem.</td> </tr> <tr> <td class="blackboard greenbg result"><span style="font-size: large">✔</span> <strong>Passed:</strong> Your schema passed a test. You want as many of these as possible!</td> <td class="blackboard yellow-ou result"><strong style="font-size: large">⚠</strong> <strong>Warning:</strong> This is a warning. It may or may not be a problem.</td> </tr> <tr> <td class="blackboard red-ou result"><span style="font-size: large">✘</span> <strong>Failed:</strong> Your schema failed a test. You want none of these!</td> <td class="blackboard result"><strong style="font-size: large">#</strong> <strong>Skipped:</strong> A test was skipped. It may or may not be a problem.</td> </tr> <tr> <td class="blackboard red-ou result"><strong style="font-size: large">☠</strong> <strong>Error:</strong> There was an error on the server—please <a href="mailto:nigel.stanger@otago.ac.nz">contact Nigel</a>.</td> <td /> </tr> </table> <hr /> <p class="blackboard grey-light result">Your results may take a few seconds to appear…</p> <div style="border: 2px solid grey; width: 50%; padding: 1em 4em 1em 4em;"> <?php $continue = true; if ( empty( $_POST['username'] ) ) { echo '<p class="unired">Missing username, please return to the login page and try again.</p>'; $continue = false; } if ( empty( $_POST['password'] ) ) { echo '<p class="unired">Missing password, please return to the login page and try again.</p>'; $continue = false; } if ( $continue ) { // Define things that need to be globally accessible as constants. define( 'ORACLE_USERNAME', $_POST['username'] ); define( 'ORACLE_PASSWORD', $_POST['password'] ); $outputMode = 'HTML'; define( 'OUTPUT_VERBOSITY', 2 ); define( 'RUN_MODE', 'student' ); require_once 'test.php'; } else { echo '<p>Redirecting you back to the login page…</p>'; header( "refresh:7;url=student_login.html" ); } ?> </div> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>INFO 214 Assignment 1 Minimum Requirement Tester: Results</title> <meta name="generator" content="BBEdit 9.6" /> <link rel="Stylesheet" href="https://blackboard.otago.ac.nz/bbcswebdav/courses/INFO321_S2DNS_2013/db_styles.css" type="text/css" /> </head> <body> <h1>INFO 214 Assignment 1 Minimum Requirement Tester: Results</h1> <p>Results may take a few seconds to appear…</p> <div style="border: 2px solid grey; width: 50%; padding: 1em 4em 1em 4em;"> <?php $continue = true; if ( empty( $_POST['username'] ) ) { echo '<p class="unired">Missing username, please return to the login page and try again.</p>'; $continue = false; } if ( empty( $_POST['password'] ) ) { echo '<p class="unired">Missing password, please return to the login page and try again.</p>'; $continue = false; } if ( $continue ) { // Define things that need to be globally accessible as constants. define( 'ORACLE_USERNAME', $_POST['username'] ); define( 'ORACLE_PASSWORD', $_POST['password'] ); $outputMode = 'HTML'; define( 'OUTPUT_VERBOSITY', 2 ); define( 'RUN_MODE', 'student' ); require_once 'test.php'; } else { echo '<p>Redirecting you back to the login page…</p>'; header( "refresh:7;url=student_login.html" ); } ?> </div> </body> </html>
Show line notes below