Added API test which checks short URLs with a domain are parsed as such

This commit is contained in:
Alejandro Celaya 2019-10-01 20:24:11 +02:00
parent d0bb86ca8f
commit 8da6b336f5
2 changed files with 26 additions and 2 deletions

View file

@ -63,13 +63,31 @@ class ListShortUrlsTest extends ApiTestCase
],
'originalUrl' => 'https://shlink.io',
],
[
'shortCode' => 'ghi789',
'shortUrl' => 'http://example.com/ghi789',
'longUrl' =>
'https://blog.alejandrocelaya.com/2019/04/27'
. '/considerations-to-properly-use-open-source-software-projects/',
'dateCreated' => '2019-01-01T00:00:00+00:00',
'visitsCount' => 0,
'tags' => [],
'meta' => [
'validSince' => null,
'validUntil' => null,
'maxVisits' => null,
],
'originalUrl' =>
'https://blog.alejandrocelaya.com/2019/04/27'
. '/considerations-to-properly-use-open-source-software-projects/',
],
],
'pagination' => [
'currentPage' => 1,
'pagesCount' => 1,
'itemsPerPage' => 10,
'itemsInCurrentPage' => 3,
'totalItems' => 3,
'itemsInCurrentPage' => 4,
'totalItems' => 4,
],
],
], $respPayload);

View file

@ -34,6 +34,12 @@ class ShortUrlsFixture extends AbstractFixture
));
$manager->persist($customShortUrl);
$withDomainShortUrl = $this->setShortUrlDate(new ShortUrl(
'https://blog.alejandrocelaya.com/2019/04/27/considerations-to-properly-use-open-source-software-projects/',
ShortUrlMeta::createFromRawData(['domain' => 'example.com'])
))->setShortCode('ghi789');
$manager->persist($withDomainShortUrl);
$manager->flush();
$this->addReference('abc123_short_url', $abcShortUrl);