mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 07:13:11 +08:00
Extended DomainNotFoundException to allow creating from an authority
This commit is contained in:
committed by
Alejandro Celaya
parent
4ef5ab7a90
commit
2ac7be4363
@@ -12,7 +12,7 @@ use function sprintf;
|
||||
class DomainNotFoundExceptionTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function properlyCreatesExceptionFromNotFoundTag(): void
|
||||
public function properlyCreatesExceptionFromId(): void
|
||||
{
|
||||
$id = '123';
|
||||
$expectedMessage = sprintf('Domain with id "%s" could not be found', $id);
|
||||
@@ -25,4 +25,19 @@ class DomainNotFoundExceptionTest extends TestCase
|
||||
self::assertEquals(['id' => $id], $e->getAdditionalData());
|
||||
self::assertEquals(404, $e->getStatus());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function properlyCreatesExceptionFromAuthority(): void
|
||||
{
|
||||
$authority = 'example.com';
|
||||
$expectedMessage = sprintf('Domain with authority "%s" could not be found', $authority);
|
||||
$e = DomainNotFoundException::fromAuthority($authority);
|
||||
|
||||
self::assertEquals($expectedMessage, $e->getMessage());
|
||||
self::assertEquals($expectedMessage, $e->getDetail());
|
||||
self::assertEquals('Domain not found', $e->getTitle());
|
||||
self::assertEquals('DOMAIN_NOT_FOUND', $e->getType());
|
||||
self::assertEquals(['authority' => $authority], $e->getAdditionalData());
|
||||
self::assertEquals(404, $e->getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user