Skip to content

Commit

Permalink
Merge branch '7.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Aug 23, 2018
2 parents 5a789fe + e14b9ba commit 42d4850
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/Util/TestDox/NamePrettifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public function prettifyTestClass(string $className): string
return $result;
}

/**
* @throws \ReflectionException
*/
public function prettifyTestCase(TestCase $test): string
{
$annotations = $test->getAnnotations();
Expand All @@ -63,20 +66,16 @@ public function prettifyTestCase(TestCase $test): string
$result = $annotations['method']['testdox'][0];

if (\strpos($result, '$') !== false) {
$annotation = $annotations['method']['testdox'][0];
$result = '';

$annotation = $annotations['method']['testdox'][0];
$providedData = $this->mapTestMethodParameterNamesToProvidedDataValues($test);

foreach (\explode(' ', $annotation) as $word) {
if (\strpos($word, '$') === 0) {
$result .= $providedData[$word] . ' ';
} else {
$result .= $word . ' ';
}
}

$result = \trim($result);
$result = trim(
str_replace(
array_keys($providedData),
$providedData,
$annotation
)
);

$annotationWithPlaceholders = true;
}
Expand Down Expand Up @@ -151,6 +150,9 @@ public function prettifyTestMethod(string $name): string
return $buffer;
}

/**
* @throws \ReflectionException
*/
private function mapTestMethodParameterNamesToProvidedDataValues(TestCase $test): array
{
$reflector = new \ReflectionMethod(\get_class($test), $test->getName(false));
Expand Down

0 comments on commit 42d4850

Please sign in to comment.