@@ -54,6 +54,9 @@ public function prettifyTestClass(string $className): string
54
54
return $ result ;
55
55
}
56
56
57
+ /**
58
+ * @throws \ReflectionException
59
+ */
57
60
public function prettifyTestCase (TestCase $ test ): string
58
61
{
59
62
$ annotations = $ test ->getAnnotations ();
@@ -63,20 +66,16 @@ public function prettifyTestCase(TestCase $test): string
63
66
$ result = $ annotations ['method ' ]['testdox ' ][0 ];
64
67
65
68
if (\strpos ($ result , '$ ' ) !== false ) {
66
- $ annotation = $ annotations ['method ' ]['testdox ' ][0 ];
67
- $ result = '' ;
68
-
69
+ $ annotation = $ annotations ['method ' ]['testdox ' ][0 ];
69
70
$ providedData = $ this ->mapTestMethodParameterNamesToProvidedDataValues ($ test );
70
71
71
- foreach (\explode (' ' , $ annotation ) as $ word ) {
72
- if (\strpos ($ word , '$ ' ) === 0 ) {
73
- $ result .= $ providedData [$ word ] . ' ' ;
74
- } else {
75
- $ result .= $ word . ' ' ;
76
- }
77
- }
78
-
79
- $ result = \trim ($ result );
72
+ $ result = trim (
73
+ str_replace (
74
+ array_keys ($ providedData ),
75
+ $ providedData ,
76
+ $ annotation
77
+ )
78
+ );
80
79
81
80
$ annotationWithPlaceholders = true ;
82
81
}
@@ -151,6 +150,9 @@ public function prettifyTestMethod(string $name): string
151
150
return $ buffer ;
152
151
}
153
152
153
+ /**
154
+ * @throws \ReflectionException
155
+ */
154
156
private function mapTestMethodParameterNamesToProvidedDataValues (TestCase $ test ): array
155
157
{
156
158
$ reflector = new \ReflectionMethod (\get_class ($ test ), $ test ->getName (false ));
0 commit comments