Add more tests

This commit is contained in:
Jaapio
2020-08-12 15:27:12 +02:00
parent 1ac416df3f
commit f0af3b7263
2 changed files with 35 additions and 2 deletions
@@ -122,6 +122,37 @@ class DescriptionFactoryTest extends TestCase
$this->assertSame($contents, $description->render());
}
/**
* @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 testDescriptionCanParseAStringContainingMultipleTags() : void
{
$contents = 'This description has a {@link http://phpdoc.org/ This} another {@link http://phpdoc.org/ This2}';
$context = new Context('');
$tagFactory = m::mock(TagFactory::class);
$tagFactory->shouldReceive('create')
->twice()
->andReturnValues(
[
new LinkTag('http://phpdoc.org/', new Description('This')),
new LinkTag('http://phpdoc.org/', new Description('This2')),
]
);
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, $context);
$this->assertSame($contents, $description->render());
$this->assertSame('This description has a %1$s another %2$s', $description->getBodyTemplate());
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*