Updated to a shlink-importer version that supports titles

This commit is contained in:
Alejandro Celaya 2021-02-04 15:24:27 +01:00
parent 7824dddef7
commit 2640c7b43c
5 changed files with 17 additions and 16 deletions

View File

@ -50,7 +50,7 @@
"shlinkio/shlink-common": "dev-main#b889f5d as 3.5",
"shlinkio/shlink-config": "^1.0",
"shlinkio/shlink-event-dispatcher": "^2.0",
"shlinkio/shlink-importer": "^2.1",
"shlinkio/shlink-importer": "dev-main#b6fc81f as 2.2",
"shlinkio/shlink-installer": "dev-develop#1ed5ac8 as 5.4",
"shlinkio/shlink-ip-geolocation": "^1.5",
"symfony/console": "^5.1",

View File

@ -89,6 +89,7 @@ class ShortUrl extends AbstractEntity
ShortUrlInputFilter::LONG_URL => $url->longUrl(),
ShortUrlInputFilter::DOMAIN => $url->domain(),
ShortUrlInputFilter::TAGS => $url->tags(),
ShortUrlInputFilter::TITLE => $url->title(),
ShortUrlInputFilter::VALIDATE_URL => false,
];
if ($importShortCode) {

View File

@ -418,7 +418,7 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
public function importedShortUrlsAreSearchedAsExpected(): void
{
$buildImported = static fn (string $shortCode, ?String $domain = null) =>
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), $domain, $shortCode);
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), $domain, $shortCode, null);
$shortUrlWithoutDomain = ShortUrl::fromImport($buildImported('my-cool-slug'), true);
$this->getEntityManager()->persist($shortUrlWithoutDomain);

View File

@ -64,7 +64,7 @@ class ShortUrlTest extends TestCase
{
yield 'no custom slug' => [ShortUrl::createEmpty()];
yield 'imported with custom slug' => [
ShortUrl::fromImport(new ImportedShlinkUrl('', '', [], Chronos::now(), null, 'custom-slug'), true),
ShortUrl::fromImport(new ImportedShlinkUrl('', '', [], Chronos::now(), null, 'custom-slug', null), true),
];
}

View File

@ -58,9 +58,9 @@ class ImportedLinksProcessorTest extends TestCase
public function newUrlsWithNoErrorsAreAllPersisted(): void
{
$urls = [
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo'),
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar'),
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz'),
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo', null),
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar', 'foo'),
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz', null),
];
$expectedCalls = count($urls);
@ -80,11 +80,11 @@ class ImportedLinksProcessorTest extends TestCase
public function alreadyImportedUrlsAreSkipped(): void
{
$urls = [
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo'),
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar'),
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz'),
new ImportedShlinkUrl('', 'baz2', [], Chronos::now(), null, 'baz2'),
new ImportedShlinkUrl('', 'baz3', [], Chronos::now(), null, 'baz3'),
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo', null),
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar', null),
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz', null),
new ImportedShlinkUrl('', 'baz2', [], Chronos::now(), null, 'baz2', null),
new ImportedShlinkUrl('', 'baz3', [], Chronos::now(), null, 'baz3', null),
];
$contains = fn (string $needle) => fn (string $text) => str_contains($text, $needle);
@ -110,11 +110,11 @@ class ImportedLinksProcessorTest extends TestCase
public function nonUniqueShortCodesAreAskedToUser(): void
{
$urls = [
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo'),
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar'),
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz'),
new ImportedShlinkUrl('', 'baz2', [], Chronos::now(), null, 'baz2'),
new ImportedShlinkUrl('', 'baz3', [], Chronos::now(), null, 'baz3'),
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo', null),
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar', null),
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz', 'foo'),
new ImportedShlinkUrl('', 'baz2', [], Chronos::now(), null, 'baz2', null),
new ImportedShlinkUrl('', 'baz3', [], Chronos::now(), null, 'baz3', 'bar'),
];
$contains = fn (string $needle) => fn (string $text) => str_contains($text, $needle);