Merge pull request #783 from fabio-ivona/fix-comments-in-test-name

fix comments in dokblocks
This commit is contained in:
Nuno Maduro
2023-04-15 11:26:06 +01:00
committed by GitHub
2 changed files with 12 additions and 1 deletions

View File

@ -14,7 +14,17 @@ final class TestDox implements AddsAnnotations
*/ */
public function __invoke(TestCaseMethodFactory $method, array $annotations): array public function __invoke(TestCaseMethodFactory $method, array $annotations): array
{ {
$annotations[] = "@testdox $method->description"; /*
* escapes docblock according to
* https://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#basics.desc
*
* note: '@' escaping is not needed as it cannot be the first character of the line (it always starts with @testdox
*/
assert($method->description !== null);
$methodDescription = str_replace('*/', '{@*}', $method->description);
$annotations[] = "@testdox $methodDescription";
return $annotations; return $annotations;
} }

View File

@ -61,6 +61,7 @@ $names = [
'Німеччина' => '__pest_evaluable_Німеччина', 'Німеччина' => '__pest_evaluable_Німеччина',
'Nam Định' => '__pest_evaluable_Nam_Định', 'Nam Định' => '__pest_evaluable_Nam_Định',
'呼和浩特' => '__pest_evaluable_呼和浩特', '呼和浩特' => '__pest_evaluable_呼和浩特',
'test /** with comment */ should do' => '__pest_evaluable_test_____with_comment____should_do',
]; ];
foreach ($names as $name => $methodName) { foreach ($names as $name => $methodName) {