From 97c3735b329f83d85131656a0697d3046647ffcd Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Wed, 24 Jun 2015 08:42:24 +0200 Subject: [PATCH] Add first integration test --- examples/interpreting-a-simple-docblock.php | 27 +++++++++++ phpunit.xml.dist | 5 +- .../integration/InterpretingDocBlocksTest.php | 47 +++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 examples/interpreting-a-simple-docblock.php create mode 100644 tests/integration/InterpretingDocBlocksTest.php 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()); + } +}