mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Created API tests for errors when editting short URL tags
This commit is contained in:
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
|
||||
|
||||
use Exception;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Prophecy\ObjectProphecy;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@@ -79,26 +78,4 @@ class ListShortUrlsActionTest extends TestCase
|
||||
'tags' => $tags = ['one', 'two'],
|
||||
], 2, null, $tags, $orderBy];
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function anExceptionReturnsErrorResponse(): void
|
||||
{
|
||||
$page = 3;
|
||||
$e = new Exception();
|
||||
|
||||
$this->service->listShortUrls($page, null, [], null)->willThrow($e)
|
||||
->shouldBeCalledOnce();
|
||||
$logError = $this->logger->error(
|
||||
'Unexpected error while listing short URLs. {e}',
|
||||
['e' => $e]
|
||||
)->will(function () {
|
||||
});
|
||||
|
||||
$response = $this->action->handle((new ServerRequest())->withQueryParams([
|
||||
'page' => $page,
|
||||
]));
|
||||
|
||||
$this->assertEquals(500, $response->getStatusCode());
|
||||
$logError->shouldHaveBeenCalledOnce();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user