mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Add first integration test
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
require_once(__DIR__ . '/../vendor/autoload.php');
|
||||||
|
|
||||||
|
use phpDocumentor\Reflection\DocBlockFactory;
|
||||||
|
|
||||||
|
$docComment = <<<DOCCOMMENT
|
||||||
|
/**
|
||||||
|
* This is an example of a summary.
|
||||||
|
*
|
||||||
|
* This is a Description. A Summary and Description are separated by either
|
||||||
|
* two subsequent newlines (thus a whiteline in between as can be seen in this
|
||||||
|
* example), or when the Summary ends with a dot (`.`) and some form of
|
||||||
|
* whitespace.
|
||||||
|
*/
|
||||||
|
DOCCOMMENT;
|
||||||
|
|
||||||
|
$factory = DocBlockFactory::createInstance();
|
||||||
|
$docblock = $factory->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();
|
||||||
+4
-1
@@ -10,8 +10,11 @@
|
|||||||
>
|
>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="unit">
|
<testsuite name="unit">
|
||||||
<directory>./tests/</directory>
|
<directory>./tests/unit</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
|
<testsuite name="integration">
|
||||||
|
<directory>./tests/integration</directory>
|
||||||
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
<filter>
|
<filter>
|
||||||
<whitelist>
|
<whitelist>
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of phpDocumentor.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* @copyright 2010-2015 Mike van Riel<[email protected]>
|
||||||
|
* @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 = <<<DESCRIPTION
|
||||||
|
This is a Description. A Summary and Description are separated by either
|
||||||
|
two subsequent newlines (thus a whiteline in between as can be seen in this
|
||||||
|
example), or when the Summary ends with a dot (`.`) and some form of
|
||||||
|
whitespace.
|
||||||
|
DESCRIPTION;
|
||||||
|
|
||||||
|
$this->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());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user