forked from matthewmueller/PHPUnit-Test-Report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sandbox.php
63 lines (46 loc) · 1.15 KB
/
Sandbox.php
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
register_shutdown_function('check_for_errors');
// Hide error messages
// error_reporting(0);
function check_for_errors() {
function toHTML($type, $e) {
$left = '<div class="box rounded error">';
$out = '<div class="light rounded">!</div>
<div class="message">'.$type.': '.$e['message'].'</div>
<div class="line">'.$e['line'].'</div>
<div class="file">'.$e['file'].'</div>';
$right = '</div>';
return $left.$out.$right;
}
$results_so_far = '';
if(@ob_get_contents()) {
$results_so_far = @ob_get_contents();
@ob_clean();
echo PHPUnit::toHTML($results_so_far);
}
if( false === is_null($aError = error_get_last()) ) {
switch($aError['type']) {
case E_NOTICE:
echo toHTML("Notice", $aError);
break;
case E_WARNING:
echo toHTML("Warning", $aError);
break;
case E_ERROR:
echo toHTML("Error", $aError);
break;
case E_PARSE:
echo toHTML("Parse", $aError);
break;
default:
echo toHTML("Unknown", $aError);
echo "<br/>";
break;
}
}
if($results_so_far) {
include('Main/footer.php');
}
exit(1);
}
?>