Completed
Push — master ( 8cc4d3...038254 )
by Alejandro
16s queued 11s
created

properlyCreatesExceptionFromNotFoundTag()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 12
rs 9.9666
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ShlinkioTest\Shlink\Rest\Exception;
6
7
use PHPUnit\Framework\TestCase;
8
use Shlinkio\Shlink\Core\Exception\TagNotFoundException;
9
10
use function sprintf;
11
12
class TagNotFoundExceptionTest extends TestCase
13
{
14
    /** @test */
15
    public function properlyCreatesExceptionFromNotFoundTag(): void
16
    {
17
        $tag = 'foo';
18
        $expectedMessage = sprintf('Tag with name "%s" could not be found', $tag);
19
        $e = TagNotFoundException::fromTag($tag);
20
21
        $this->assertEquals($expectedMessage, $e->getMessage());
22
        $this->assertEquals($expectedMessage, $e->getDetail());
23
        $this->assertEquals('Tag not found', $e->getTitle());
24
        $this->assertEquals('TAG_NOT_FOUND', $e->getType());
25
        $this->assertEquals(['tag' => $tag], $e->getAdditionalData());
26
        $this->assertEquals(404, $e->getStatus());
27
    }
28
}
29