@@ -40,30 +40,44 @@ protected function printDefectTrace(TestFailure $defect): void
40
40
$ e = $ defect ->thrownException ();
41
41
42
42
$ errorLines = array_filter (
43
- explode (PHP_EOL , (string )$ e ),
44
- function ($ l ){ return $ l ; }
43
+ explode (PHP_EOL , (string )$ e ),
44
+ function ($ l ) {
45
+ return $ l ;
46
+ }
45
47
);
46
48
47
49
list ($ path , $ line ) = explode (": " , end ($ errorLines ));
48
50
49
51
if (!$ path ) {
50
- list ($ path , $ line ) = $ this ->getReflectionFromTest ($ defect ->getTestName ());
52
+ list ($ path , $ line ) = $ this ->getReflectionFromTest (
53
+ $ defect ->getTestName ()
54
+ );
51
55
}
52
56
53
57
$ message = explode (PHP_EOL , $ e ->getMessage ())[0 ];
54
58
55
- $ this ->write (":: {$ this ->getCurrentType ()} file= {$ this ->relativePath ($ path )},line= {$ line }:: {$ message }\n" );
59
+ $ type = $ this ->getCurrentType ();
60
+ $ file = "file= {$ this ->relativePath ($ path )}" ;
61
+ $ line = "line= {$ line }" ;
62
+ $ this ->write (":: {$ type } $ file, $ line:: {$ message }\n" );
56
63
}
57
64
58
- protected function getCurrentType () {
59
- return in_array ($ this ->currentType , ['error ' , 'failure ' ]) ? 'error ' : 'warning ' ;
65
+ protected function getCurrentType ()
66
+ {
67
+ if (in_array ($ this ->currentType , ['error ' , 'failure ' ])) {
68
+ return 'error ' ;
69
+ }
70
+
71
+ return 'warning ' ;
60
72
}
61
73
62
- protected function relativePath (string $ path ) {
63
- return str_replace (getcwd ().'/ ' , '' , $ path );
74
+ protected function relativePath (string $ path )
75
+ {
76
+ return str_replace (getcwd () . '/ ' , '' , $ path );
64
77
}
65
78
66
- protected function getReflectionFromTest (string $ name ) {
79
+ protected function getReflectionFromTest (string $ name )
80
+ {
67
81
list ($ klass , $ method ) = explode (':: ' , $ name );
68
82
$ c = new \ReflectionClass ($ klass );
69
83
$ m = $ c ->getMethod ($ method );
0 commit comments