mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Add integration test and example on how to read tags
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\See;
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
@@ -29,7 +32,7 @@ class InterpretingDocBlocksTest extends \PHPUnit_Framework_TestCase
|
||||
* @var string $summary
|
||||
* @var Description $description
|
||||
*/
|
||||
include(__DIR__ . '/../../examples/interpreting-a-simple-docblock.php');
|
||||
include(__DIR__ . '/../../examples/01-interpreting-a-simple-docblock.php');
|
||||
|
||||
$descriptionText = <<<DESCRIPTION
|
||||
This is a Description. A Summary and Description are separated by either
|
||||
@@ -44,4 +47,26 @@ DESCRIPTION;
|
||||
$this->assertSame($descriptionText, $description->render());
|
||||
$this->assertEmpty($docblock->getTags());
|
||||
}
|
||||
|
||||
public function testInterpretingTags()
|
||||
{
|
||||
/**
|
||||
* @var DocBlock $docblock
|
||||
* @var boolean $hasSeeTag
|
||||
* @var Tag[] $tags
|
||||
* @var See[] $seeTags
|
||||
*/
|
||||
include(__DIR__ . '/../../examples/02-interpreting-tags.php');
|
||||
|
||||
$this->assertTrue($hasSeeTag);
|
||||
$this->assertCount(1, $tags);
|
||||
$this->assertCount(1, $seeTags);
|
||||
|
||||
$this->assertInstanceOf(See::class, $tags[0]);
|
||||
$this->assertInstanceOf(See::class, $seeTags[0]);
|
||||
|
||||
$seeTag = $seeTags[0];
|
||||
$this->assertSame('\\' . StandardTagFactory::class, (string)$seeTag->getReference());
|
||||
$this->assertSame('', (string)$seeTag->getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user