mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Fixes implementation of Example tag
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Example;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Tags\Example
|
||||
*/
|
||||
class ExampleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers ::create
|
||||
* @covers ::__construct
|
||||
* @covers ::getContent
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
|
||||
*/
|
||||
public function testExampleWithoutContent()
|
||||
{
|
||||
$tag = Example::create('"example1.php"');
|
||||
$this->assertEquals('"example1.php"', $tag->getContent());
|
||||
$this->assertEquals('', $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::create
|
||||
* @covers ::__construct
|
||||
* @covers ::getFilePath
|
||||
* @covers ::getDescription
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
|
||||
*/
|
||||
public function testWithDescription()
|
||||
{
|
||||
$tag = Example::create('"example1.php" some text');
|
||||
$this->assertEquals('example1.php', $tag->getFilePath());
|
||||
$this->assertEquals('some text', $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::create
|
||||
* @covers ::__construct
|
||||
* @covers ::getFilePath
|
||||
* @covers ::getStartingLine
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
|
||||
*/
|
||||
public function testStartlineIsParsed()
|
||||
{
|
||||
$tag = Example::create('"example1.php" 10');
|
||||
$this->assertEquals('example1.php', $tag->getFilePath());
|
||||
$this->assertEquals(10, $tag->getStartingLine());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::create
|
||||
* @covers ::__construct
|
||||
* @covers ::getFilePath
|
||||
* @covers ::getStartingLine
|
||||
* @covers ::getDescription
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
|
||||
*/
|
||||
public function testAllowOmitingLineCount()
|
||||
{
|
||||
$tag = Example::create('"example1.php" 10 some text');
|
||||
$this->assertEquals('example1.php', $tag->getFilePath());
|
||||
$this->assertEquals(10, $tag->getStartingLine());
|
||||
$this->assertEquals('some text', $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::create
|
||||
* @covers ::__construct
|
||||
* @covers ::getFilePath
|
||||
* @covers ::getStartingLine
|
||||
* @covers ::getLineCount
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
|
||||
*/
|
||||
public function testLengthIsParsed()
|
||||
{
|
||||
$tag = Example::create('"example1.php" 10 5');
|
||||
$this->assertEquals('example1.php', $tag->getFilePath());
|
||||
$this->assertEquals(10, $tag->getStartingLine());
|
||||
$this->assertEquals(5, $tag->getLineCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::create
|
||||
* @covers ::__construct
|
||||
* @covers ::getFilePath
|
||||
* @covers ::getStartingLine
|
||||
* @covers ::getLineCount
|
||||
* @covers ::getDescription
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
|
||||
*/
|
||||
public function testFullExample()
|
||||
{
|
||||
$tag = Example::create('"example1.php" 10 5 test text');
|
||||
$this->assertEquals('example1.php', $tag->getFilePath());
|
||||
$this->assertEquals(10, $tag->getStartingLine());
|
||||
$this->assertEquals(5, $tag->getLineCount());
|
||||
$this->assertEquals('test text', $tag->getDescription());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user