mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Improved public API in ShortUrl entity, reducing anemic model
This commit is contained in:
@@ -54,8 +54,7 @@ class CreateShortUrlActionTest extends TestCase
|
||||
{
|
||||
$this->urlShortener->urlToShortCode(Argument::type(Uri::class), Argument::type('array'), Argument::cetera())
|
||||
->willReturn(
|
||||
(new ShortUrl())->setShortCode('abc123')
|
||||
->setLongUrl('')
|
||||
(new ShortUrl(''))->setShortCode('abc123')
|
||||
)
|
||||
->shouldBeCalledTimes(1);
|
||||
|
||||
|
||||
@@ -82,7 +82,9 @@ class EditShortUrlActionTest extends TestCase
|
||||
->withParsedBody([
|
||||
'maxVisits' => 5,
|
||||
]);
|
||||
$updateMeta = $this->shortUrlService->updateMetadataByShortCode(Argument::cetera())->willReturn(new ShortUrl());
|
||||
$updateMeta = $this->shortUrlService->updateMetadataByShortCode(Argument::cetera())->willReturn(
|
||||
new ShortUrl('')
|
||||
);
|
||||
|
||||
$resp = $this->action->handle($request);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class EditShortUrlTagsActionTest extends TestCase
|
||||
public function tagsListIsReturnedIfCorrectShortCodeIsProvided()
|
||||
{
|
||||
$shortCode = 'abc123';
|
||||
$this->shortUrlService->setTagsByShortCode($shortCode, [])->willReturn(new ShortUrl())
|
||||
$this->shortUrlService->setTagsByShortCode($shortCode, [])->willReturn(new ShortUrl(''))
|
||||
->shouldBeCalledTimes(1);
|
||||
|
||||
$response = $this->action->handle(
|
||||
|
||||
@@ -55,7 +55,7 @@ class ResolveShortUrlActionTest extends TestCase
|
||||
{
|
||||
$shortCode = 'abc123';
|
||||
$this->urlShortener->shortCodeToUrl($shortCode)->willReturn(
|
||||
(new ShortUrl())->setLongUrl('http://domain.com/foo/bar')
|
||||
new ShortUrl('http://domain.com/foo/bar')
|
||||
)->shouldBeCalledTimes(1);
|
||||
|
||||
$request = ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode);
|
||||
|
||||
@@ -103,7 +103,7 @@ class SingleStepCreateShortUrlActionTest extends TestCase
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)->willReturn((new ShortUrl())->setLongUrl(''));
|
||||
)->willReturn(new ShortUrl(''));
|
||||
|
||||
$resp = $this->action->handle($request);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user