6
6
use PHPUnit \Framework \TestFailure ;
7
7
use PHPUnit \Framework \TestListener ;
8
8
use PHPUnit \Framework \TestSuite ;
9
+ use PHPUnit \Runner \BaseTestRunner ;
9
10
use PHPUnit \TextUI \ResultPrinter ;
10
11
use PHPUnit \Util \Filter ;
11
12
@@ -52,7 +53,35 @@ public function endTest(Test $test, float $time): void
52
53
}
53
54
54
55
$ this ->write (' ' );
55
- $ this ->writeWithColor ($ color , $ name , false );
56
+
57
+ switch ($ test ->getStatus ()) {
58
+ case BaseTestRunner::STATUS_PASSED :
59
+ $ this ->writeWithColor ('fg-green ' , $ name , false );
60
+ break ;
61
+ case BaseTestRunner::STATUS_SKIPPED :
62
+ $ this ->writeWithColor ('fg-yellow ' , $ name , false );
63
+ break ;
64
+ case BaseTestRunner::STATUS_INCOMPLETE :
65
+ $ this ->writeWithColor ('fg-blue ' , $ name , false );
66
+ break ;
67
+ case BaseTestRunner::STATUS_FAILURE :
68
+ $ this ->writeWithColor ('fg-red ' , $ name , false );
69
+ break ;
70
+ case BaseTestRunner::STATUS_ERROR :
71
+ $ this ->writeWithColor ('fg-red ' , $ name , false );
72
+ break ;
73
+ case BaseTestRunner::STATUS_RISKY :
74
+ $ this ->writeWithColor ('fg-magenta ' , $ name , false );
75
+ break ;
76
+ case BaseTestRunner::STATUS_WARNING :
77
+ $ this ->writeWithColor ('fg-yellow ' , $ name , false );
78
+ break ;
79
+ case BaseTestRunner::STATUS_UNKNOWN :
80
+ default :
81
+ $ this ->writeWithColor ('fg-cyan ' , $ name , false );
82
+ break ;
83
+ }
84
+
56
85
$ this ->write (' ' );
57
86
58
87
$ timeColor = $ time > 0.5 ? 'fg-yellow ' : 'fg-white ' ;
@@ -69,10 +98,31 @@ protected function writeProgress(string $progress): void
69
98
70
99
$ this ->previousClassName = $ this ->className ;
71
100
72
- if ($ progress == '. ' ) {
73
- $ this ->writeWithColor ('fg-green ' , ' ✓ ' , false );
74
- } else {
75
- $ this ->writeWithColor ('fg-red ' , ' x ' , false );
101
+ switch (strtoupper (preg_replace ('# \\x1b[[][^A-Za-z]*[A-Za-z]# ' , '' , $ progress ))) {
102
+ case '. ' :
103
+ $ this ->writeWithColor ('fg-green ' , ' ✓ ' , false );
104
+ break ;
105
+ case 'S ' :
106
+ $ this ->writeWithColor ('fg-yellow ' , ' → ' , false );
107
+ break ;
108
+ case 'I ' :
109
+ $ this ->writeWithColor ('fg-blue ' , ' ∅ ' , false );
110
+ break ;
111
+ case 'F ' :
112
+ $ this ->writeWithColor ('fg-red ' , ' x ' , false );
113
+ break ;
114
+ case 'E ' :
115
+ $ this ->writeWithColor ('fg-red ' , ' ⚈ ' , false );
116
+ break ;
117
+ case 'R ' :
118
+ $ this ->writeWithColor ('fg-magenta ' , ' ⌽ ' , false );
119
+ break ;
120
+ case 'W ' :
121
+ $ this ->writeWithColor ('fg-yellow ' , ' ¤ ' , false );
122
+ break ;
123
+ default :
124
+ $ this ->writeWithColor ('fg-cyan ' , ' ≈ ' , false );
125
+ break ;
76
126
}
77
127
}
78
128
0 commit comments