Skip to content

Commit

Permalink
Merge pull request #783 from fabio-ivona/fix-comments-in-test-name
Browse files Browse the repository at this point in the history
fix comments in dokblocks
  • Loading branch information
nunomaduro committed Apr 15, 2023
2 parents f6d9aa5 + e1143d2 commit 9744b98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Factories/Annotations/TestDox.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ final class TestDox implements AddsAnnotations
*/
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;
}
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/TestName.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
'Німеччина' => '__pest_evaluable_Німеччина',
'Nam Định' => '__pest_evaluable_Nam_Định',
'呼和浩特' => '__pest_evaluable_呼和浩特',
'test /** with comment */ should do' => '__pest_evaluable_test_____with_comment____should_do',
];

foreach ($names as $name => $methodName) {
Expand Down

0 comments on commit 9744b98

Please sign in to comment.