diff --git a/examples/interpreting-a-simple-docblock.php b/examples/interpreting-a-simple-docblock.php new file mode 100644 index 0000000..6d67dea --- /dev/null +++ b/examples/interpreting-a-simple-docblock.php @@ -0,0 +1,27 @@ +create($docComment); + +// Should contain the first line of the DocBlock +$summary = $docblock->getSummary(); + +// Contains an object of type Description; you can either cast it to string or use +// the render method to get a string representation of the Description. +// +// In subsequent examples we will be fiddling a bit more with the Description. +$description = $docblock->getDescription(); diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4393b02..3c2e9a3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -10,8 +10,11 @@ > - ./tests/ + ./tests/unit + + ./tests/integration + diff --git a/tests/integration/InterpretingDocBlocksTest.php b/tests/integration/InterpretingDocBlocksTest.php new file mode 100644 index 0000000..ec90fae --- /dev/null +++ b/tests/integration/InterpretingDocBlocksTest.php @@ -0,0 +1,47 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\DocBlock\Description; + +/** + * @coversNothing + */ +class InterpretingDocBlocksTest extends \PHPUnit_Framework_TestCase +{ + /** + * @link ../../examples/interpreting-a-simple-docblock.php + */ + public function testInterpretingASimpleDocBlock() + { + /** + * @var DocBlock $docblock + * @var string $summary + * @var Description $description + */ + include(__DIR__ . '/../../examples/interpreting-a-simple-docblock.php'); + + $descriptionText = <<assertInstanceOf(DocBlock::class, $docblock); + $this->assertSame('This is an example of a summary.', $summary); + $this->assertInstanceOf(Description::class, $description); + $this->assertSame($descriptionText, $description->render()); + $this->assertEmpty($docblock->getTags()); + } +}