forked from simpletest/simpletest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestdox.php
52 lines (44 loc) · 1.25 KB
/
testdox.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
<?php
require_once dirname(__FILE__) . '/../reporter.php';
/**
* Extension for a TestDox reporter
*/
class TestDoxReporter extends SimpleReporter
{
public $_test_case_pattern = '/^TestOf(.*)$/';
public function __construct($test_case_pattern = '/^TestOf(.*)$/')
{
parent::__construct();
$this->_test_case_pattern = empty($test_case_pattern) ? '/^(.*)$/' : $test_case_pattern;
}
public function paintCaseStart($test_name)
{
preg_match($this->_test_case_pattern, $test_name, $matches);
if (!empty($matches[1])) {
echo $matches[1] . "\n";
} else {
echo $test_name . "\n";
}
}
public function paintCaseEnd($test_name)
{
echo "\n";
}
public function paintMethodStart($test_name)
{
if (!preg_match('/^test(.*)$/i', $test_name, $matches)) {
return;
}
$test_name = $matches[1];
$test_name = preg_replace('/([A-Z])([A-Z])/', '$1 $2', $test_name);
echo '- ' . strtolower(preg_replace('/([a-zA-Z])([A-Z0-9])/', '$1 $2', $test_name));
}
public function paintMethodEnd($test_name)
{
echo "\n";
}
public function paintFail($message)
{
echo ' [FAILED]';
}
}