Skip to content

Commit 1b78639

Browse files
committed
Add testcase for invalid tag creation
1 parent bdecc2d commit 1b78639

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/unit/DocBlock/StandardTagFactoryTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
1919
use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter;
2020
use phpDocumentor\Reflection\DocBlock\Tags\Generic;
21+
use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag;
2122
use phpDocumentor\Reflection\DocBlock\Tags\Return_;
2223
use phpDocumentor\Reflection\DocBlock\Tags\See;
2324
use phpDocumentor\Reflection\Fqsen;
@@ -330,4 +331,14 @@ public function testReturnTagIsMappedCorrectly() : void
330331
$this->assertInstanceOf(Return_::class, $tag);
331332
$this->assertSame('return', $tag->getName());
332333
}
334+
335+
public function testInvalidTagIsReturnedOnFailure()
336+
{
337+
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class));
338+
339+
/** @var InvalidTag $tag */
340+
$tag = $tagFactory->create('@see $name some invalid tag');
341+
342+
$this->assertInstanceOf(InvalidTag::class, $tag);
343+
}
333344
}

0 commit comments

Comments
 (0)