@@ -177,7 +177,7 @@ private function printTestResultBody(TestDoxTestResult $test): void
177177 }
178178
179179 $ this ->printTestResultBodyStart ($ test );
180- $ this ->printThrowable ($ test );
180+ $ this ->printThrowable ($ test-> status (), $ test -> throwable () );
181181 $ this ->printTestResultBodyEnd ($ test );
182182 }
183183
@@ -207,10 +207,8 @@ private function printTestResultBodyEnd(TestDoxTestResult $test): void
207207 $ this ->printer ->print (PHP_EOL );
208208 }
209209
210- private function printThrowable (TestDoxTestResult $ test ): void
210+ private function printThrowable (TestStatus $ status , Throwable $ throwable ): void
211211 {
212- $ throwable = $ test ->throwable ();
213-
214212 assert ($ throwable instanceof Throwable);
215213
216214 $ message = trim ($ throwable ->description ());
@@ -220,14 +218,14 @@ private function printThrowable(TestDoxTestResult $test): void
220218 if (!empty ($ message ) && $ this ->colors ) {
221219 ['message ' => $ message , 'diff ' => $ diff ] = $ this ->colorizeMessageAndDiff (
222220 $ message ,
223- $ this ->messageColorFor ($ test -> status () ),
221+ $ this ->messageColorFor ($ status ),
224222 );
225223 }
226224
227225 if (!empty ($ message )) {
228226 $ this ->printer ->print (
229227 $ this ->prefixLines (
230- $ this ->prefixFor ('message ' , $ test -> status () ),
228+ $ this ->prefixFor ('message ' , $ status ),
231229 $ message ,
232230 ),
233231 );
@@ -238,7 +236,7 @@ private function printThrowable(TestDoxTestResult $test): void
238236 if (!empty ($ diff )) {
239237 $ this ->printer ->print (
240238 $ this ->prefixLines (
241- $ this ->prefixFor ('diff ' , $ test -> status () ),
239+ $ this ->prefixFor ('diff ' , $ status ),
242240 $ diff ,
243241 ),
244242 );
@@ -248,13 +246,13 @@ private function printThrowable(TestDoxTestResult $test): void
248246
249247 if (!empty ($ stackTrace )) {
250248 if (!empty ($ message ) || !empty ($ diff )) {
251- $ prefix = $ this ->prefixFor ('default ' , $ test -> status () );
249+ $ tracePrefix = $ this ->prefixFor ('default ' , $ status );
252250 } else {
253- $ prefix = $ this ->prefixFor ('trace ' , $ test -> status () );
251+ $ tracePrefix = $ this ->prefixFor ('trace ' , $ status );
254252 }
255253
256254 $ this ->printer ->print (
257- $ this ->prefixLines ($ prefix , PHP_EOL . $ stackTrace ),
255+ $ this ->prefixLines ($ tracePrefix , PHP_EOL . $ stackTrace ),
258256 );
259257 }
260258 }
0 commit comments