Completed
Push — master ( 43f90a...f256f0 )
by Jaap
21:44 queued 11:35
created

InvalidTagTest::testCreationWithError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace phpDocumentor\Reflection\DocBlock\Tags;
6
7
use Exception;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Tags\InvalidTag
12
 * @covers ::<private>
13
 * @covers ::getName
14
 * @covers ::render
15
 * @covers ::getException
16
 * @covers ::create
17
 */
18
final class InvalidTagTest extends TestCase
19
{
20
    public function testCreationWithoutError() : void
21
    {
22
        $tag = InvalidTag::create('Body', 'name');
23
24
        self::assertSame('name', $tag->getName());
25
        self::assertSame('@name Body', $tag->render());
26
        self::assertNull($tag->getException());
27
    }
28
29
    /**
30
     * @covers ::withError
31
     */
32
    public function testCreationWithError() : void
33
    {
34
        $exception = new Exception();
35
        $tag       = InvalidTag::create('Body', 'name')->withError($exception);
36
37
        self::assertSame('name', $tag->getName());
38
        self::assertSame('@name Body', $tag->render());
39
        self::assertSame($exception, $tag->getException());
40
    }
41
}
42