Add integration test and example on how to read tags

This commit is contained in:
Mike van Riel
2015-06-24 22:50:12 +02:00
parent 97c3735b32
commit cff8a80680
3 changed files with 50 additions and 1 deletions
@@ -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());
}
}