more follow-up to r65715: coding style tweaks, etc.
[lhc/web/wiklou.git] / maintenance / tests / selenium / SeleniumTestHTMLLogger.php
1 <?php
2 if ( !defined( 'MEDIAWIKI' ) || !defined( 'SELENIUMTEST' ) ) {
3 echo "This script cannot be run standalone";
4 exit( 1 );
5 }
6
7 class SeleniumTestHTMLLogger {
8 public function __construct() {
9 // Prepare testsuite for immediate output
10 @ini_set( 'zlib.output_compression', 0 );
11 @ini_set( 'implicit_flush', 1 );
12 for ( $i = 0; $i < ob_get_level(); $i++ ) {
13 ob_end_flush();
14 }
15 ob_implicit_flush( 1 );
16
17 // Output some style information
18 echo '<style>
19 pre {
20 overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
21 white-space: pre-wrap; /* css-3 */
22 white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
23 white-space: -pre-wrap; /* Opera 4-6 */
24 white-space: -o-pre-wrap; /* Opera 7 */
25 /* width: 99%; */
26 word-wrap: break-word; /* Internet Explorer 5.5+ */
27 }
28 </style>';
29 }
30
31 public function write( $message, $mode = false ) {
32 $out = '';
33 if ( $mode == MW_TESTLOGGER_RESULT_OK ) {
34 $out .= '<font color="green">';
35 }
36 $out .= htmlentities( $message );
37 if ( $mode == MW_TESTLOGGER_RESULT_OK ) {
38 $out .= '</font>';
39 }
40 if ( $mode != MW_TESTLOGGER_CONTINUE_LINE ) {
41 $out .= '<br />';
42 }
43
44 echo $out;
45 }
46 }