From 260a74a77bae8c9ae88afa205267c75d670d3086 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 14 Jun 2015 08:18:12 +0200 Subject: [PATCH] Expand tests of Author tag with BaseTag covered functionality --- .../unit/DocBlock/DescriptionFactoryTest.php | 6 --- tests/unit/DocBlock/Tags/AuthorTest.php | 40 ++++++++++++++++++- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/tests/unit/DocBlock/DescriptionFactoryTest.php b/tests/unit/DocBlock/DescriptionFactoryTest.php index 0e478af..567a236 100644 --- a/tests/unit/DocBlock/DescriptionFactoryTest.php +++ b/tests/unit/DocBlock/DescriptionFactoryTest.php @@ -13,12 +13,6 @@ namespace phpDocumentor\Reflection\DocBlock; use Mockery as m; -use phpDocumentor\Reflection\DocBlock\Description\PassthroughFormatter; -use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; -use phpDocumentor\Reflection\DocBlock\Tags\Link; -use phpDocumentor\Reflection\DocBlock\Tags\Other; -use phpDocumentor\Reflection\Types\Context; - /** * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\DescriptionFactory */ diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php index f86c8c5..431195a 100644 --- a/tests/unit/DocBlock/Tags/AuthorTest.php +++ b/tests/unit/DocBlock/Tags/AuthorTest.php @@ -13,8 +13,6 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; use Mockery as m; -use phpDocumentor\Reflection\DocBlock\Description; -use phpDocumentor\Reflection\DocBlock\Tags\Other; /** * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Tags\Author @@ -22,6 +20,44 @@ use phpDocumentor\Reflection\DocBlock\Tags\Other; */ class AuthorTest extends \PHPUnit_Framework_TestCase { + /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct + * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName + */ + public function testIfCorrectTagNameIsReturned() + { + $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); + + $this->assertSame('author', $fixture->getName()); + } + + /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__toString + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render + */ + public function testIfTagCanBeRenderedUsingDefaultFormatter() + { + $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); + + $this->assertSame('Mike van Riel', $fixture->render()); + } + + /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct + * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render + */ + public function testIfTagCanBeRenderedUsingSpecificFormatter() + { + $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); + + $formatter = m::mock(Formatter::class); + $formatter->shouldReceive('format')->with($fixture)->andReturn('Rendered output'); + + $this->assertSame('Rendered output', $fixture->render($formatter)); + } + /** * @covers ::__construct * @covers ::getAuthorName