Open
Description
Given the following test case, our Description doesn't work as expected with nested braces in inline tags.
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::__construct
* @covers ::create
*/
public function testDescriptionCanParseStringWithInlineTagAndBraces() : void
{
$contents = 'This description has a {@link http://phpdoc.org/ This contains {braces} }';
$context = new Context('');
$tagFactory = m::mock(TagFactory::class);
$tagFactory->shouldReceive('create')
->twice()
->andReturnValues(
[
new LinkTag('http://phpdoc.org/', new Description('This contains {braces}')),
]
);
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, $context);
$this->assertSame($contents, $description->render());
$this->assertSame('This description has a %1$s', $description->getBodyTemplate());
}