follow-up to r65715: convert spaces to tabs for indentation, as per our coding standa...
[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 {
9 public function __construct()
10 {
11 // Prepare testsuite for immediate output
12 @ini_set('zlib.output_compression', 0);
13 @ini_set('implicit_flush', 1);
14 for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
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 }
32
33 public function write($message, $mode = false)
34 {
35 $out .= '';
36 if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '<font color="green">';
37 $out .= htmlentities($message);
38 if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '</font>';
39 if ($mode != MW_TESTLOGGER_CONTINUE_LINE) $out .= '<br/>';
40
41 echo $out;
42 }
43 }