Passed
Pull Request — master (#559)
by Alejandro
05:52
created

TagNotFoundExceptionTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A properlyCreatesExceptionFromNotFoundTag() 0 12 1
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