@@ -54,6 +54,9 @@ public function prettifyTestClass(string $className): string
5454 return $ result ;
5555 }
5656
57+ /**
58+ * @throws \ReflectionException
59+ */
5760 public function prettifyTestCase (TestCase $ test ): string
5861 {
5962 $ annotations = $ test ->getAnnotations ();
@@ -63,20 +66,16 @@ public function prettifyTestCase(TestCase $test): string
6366 $ result = $ annotations ['method ' ]['testdox ' ][0 ];
6467
6568 if (\strpos ($ result , '$ ' ) !== false ) {
66- $ annotation = $ annotations ['method ' ]['testdox ' ][0 ];
67- $ result = '' ;
68-
69+ $ annotation = $ annotations ['method ' ]['testdox ' ][0 ];
6970 $ providedData = $ this ->mapTestMethodParameterNamesToProvidedDataValues ($ test );
7071
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+ );
8079
8180 $ annotationWithPlaceholders = true ;
8281 }
@@ -151,6 +150,9 @@ public function prettifyTestMethod(string $name): string
151150 return $ buffer ;
152151 }
153152
153+ /**
154+ * @throws \ReflectionException
155+ */
154156 private function mapTestMethodParameterNamesToProvidedDataValues (TestCase $ test ): array
155157 {
156158 $ reflector = new \ReflectionMethod (\get_class ($ test ), $ test ->getName (false ));
0 commit comments