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
• Refactored output_stream to outputStream.
• Removed spurious extra default: in switch statement.
master
1 parent
0cef39b
commit
1c61456c3b70f6fda0318a93c7778846e8322ef0
Nigel Stanger
authored
on 17 Mar 2014
Patch
Showing
1 changed file
Unit_testing/Reporter/HTMLReporter.php
Ignore Space
Show notes
View
Unit_testing/Reporter/HTMLReporter.php
<?php require_once 'Reporter.php'; class HTMLReporter extends Reporter { private $outputStream; function __construct( $verbosity ) { $this->outputStream = fopen( 'php://output', 'w' ); parent::__construct( $verbosity ); } public function report( $status, $reportText, $printfArguments = null ) { if ( ( $status === Reporter::STATUS_DEBUG ) && ( $this->getVerbosity() !== Reporter::VERBOSITY_DEBUG ) ) return; if ( $this->getVerbosity() > Reporter::VERBOSITY_NONE ) { $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 .= ' yellow-ou result"><strong style="font-size: large">%</strong> '; break; case Reporter::STATUS_FAILURE: $statusText .= ' red-ou result""><span style="font-size: large">✘</span> '; break; case Reporter::STATUS_ERROR: $statusText .= ' red-ou result"><span style="font-size: large">☠</span> '; break; case Reporter::STATUS_WARNING: $statusText .= ' yellow-ou result"><span style="font-size: large">⚠</span> '; break; case Reporter::STATUS_NOTE: case Reporter::STATUS_DEBUG: $statusText .= ' grey-light result">'; break; case Reporter::STATUS_TEST: $statusText .= ' style="font-weight: bold;">'; break; default: $statusText .= ' yellow-ou result"><strong style="font-size: large">?</strong> '; break; } if ( $this->getVerbosity() > Reporter::VERBOSITY_STUDENT ) $statusText .= "<strong>" . ucfirst( strtolower( $status ) ) . ':</strong> '; $message = vsprintf( $statusText . $reportText . "</span></p>\n", $printfArguments ); fwrite( $this->outputStream, $message ); } } public function hr() { echo "<hr />\n"; } } ?>
<?php require_once 'Reporter.php'; class HTMLReporter extends Reporter { private $output_stream; function __construct( $verbosity ) { $this->output_stream = fopen( 'php://output', 'w' ); parent::__construct( $verbosity ); } public function report( $status, $reportText, $printfArguments = null ) { if ( ( $status === Reporter::STATUS_DEBUG ) && ( $this->getVerbosity() !== Reporter::VERBOSITY_DEBUG ) ) return; if ( $this->getVerbosity() > Reporter::VERBOSITY_NONE ) { $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 .= ' yellow-ou result"><strong style="font-size: large">%</strong> '; break; case Reporter::STATUS_FAILURE: $statusText .= ' red-ou result""><span style="font-size: large">✘</span> '; break; case Reporter::STATUS_ERROR: $statusText .= ' red-ou result"><span style="font-size: large">☠</span> '; break; case Reporter::STATUS_WARNING: $statusText .= ' yellow-ou result"><span style="font-size: large">⚠</span> '; break; case Reporter::STATUS_NOTE: case Reporter::STATUS_DEBUG: $statusText .= ' grey-light result">'; break; default: case Reporter::STATUS_TEST: $statusText .= ' style="font-weight: bold;">'; break; default: $statusText .= ' yellow-ou result"><strong style="font-size: large">?</strong> '; break; } if ( $this->getVerbosity() > Reporter::VERBOSITY_STUDENT ) $statusText .= "<strong>" . ucfirst( strtolower( $status ) ) . ':</strong> '; $message = vsprintf( $statusText . $reportText . "</span></p>\n", $printfArguments ); fwrite( $this->output_stream, $message ); } } public function hr() { echo "<hr />\n"; } } ?>
Show line notes below