summaryrefslogtreecommitdiff
path: root/tests/selenium/SeleniumTestConsoleLogger.php
blob: b6f5496ce9691e11924334db97f7c20ade515684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

class SeleniumTestConsoleLogger {
	public function __construct() {
		// Prepare testsuite for immediate output
		@ini_set( 'zlib.output_compression', 0 );
		@ini_set( 'implicit_flush', 1 );
		for ( $i = 0; $i < ob_get_level(); $i++ ) {
			ob_end_flush();
		}
		ob_implicit_flush( 1 );
	}

	public function write( $message, $mode = false ) {
		$out = '';
		// if ( $mode == SeleniumTestSuite::RESULT_OK ) $out .= '<font color="green">';
		$out .= htmlentities( $message );
		// if ( $mode == SeleniumTestSuite::RESULT_OK ) $out .= '</font>';
		if ( $mode != SeleniumTestSuite::CONTINUE_LINE ) {
			$out .= "\n";
		}

		echo $out;
	}
}