-
Notifications
You must be signed in to change notification settings - Fork 0
/
WpSimpleTestReporter.php
executable file
·46 lines (39 loc) · 1.46 KB
/
WpSimpleTestReporter.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
<?php
class WpSimpleTestReporter extends HtmlReporter {
private $showPasses;
function __construct($showPasses) {
$this->showPasses = $showPasses;
parent::__construct('UTF-8');
}
function paintHeader($test_name) {
print "<h3 class=\"SimpleTestHeader\">$test_name</h3>\n";
print "<div class=\"SimpleTest\">\n";
flush();
}
function paintFooter($test_name) {
if ($this->getFailCount() + $this->getExceptionCount() > 0) {
$resultBarColor = "SimpleTestFailBarColor";
}
else {
$resultBarColor = "SimpleTestPassBarColor";
}
print "<div class=\"SimpleTestSummary $resultBarColor\">";
print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount();
print " test cases complete:\n";
print "<strong>" . $this->getPassCount() . "</strong> passes, ";
print "<strong>" . $this->getFailCount() . "</strong> fails and ";
print "<strong>" . $this->getExceptionCount() . "</strong> exceptions.";
print "</div>\n";
print "</div>\n";
}
function paintPass($message) {
parent::paintPass($message);
if (stripos($this->showPasses, 'y') === 0) {
print "<span class=\"pass\">Pass</span>: ";
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print implode("->", $breadcrumb);
print "->$message<br />\n";
}
}
}