fix comments in dokblocks

This commit is contained in:
Fabio Ivona
2023-04-15 10:45:51 +02:00
parent f6d9aa51bd
commit 5861b0498a
2 changed files with 14 additions and 2 deletions

View File

@ -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;
}

View File

@ -61,6 +61,7 @@ $names = [
'Німеччина' => '__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) {
@ -68,5 +69,6 @@ foreach ($names as $name => $methodName) {
->expect(fn () => static::getLatestPrintableTestCaseMethodName())
->toBe($name)
->and(fn () => $this->name())
->toBe($methodName);
->toBe($methodName)
->only();
}