mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-22 23:23:42 -06:00
Updated to a shlink-importer version that supports titles
This commit is contained in:
parent
7824dddef7
commit
2640c7b43c
@ -50,7 +50,7 @@
|
|||||||
"shlinkio/shlink-common": "dev-main#b889f5d as 3.5",
|
"shlinkio/shlink-common": "dev-main#b889f5d as 3.5",
|
||||||
"shlinkio/shlink-config": "^1.0",
|
"shlinkio/shlink-config": "^1.0",
|
||||||
"shlinkio/shlink-event-dispatcher": "^2.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-installer": "dev-develop#1ed5ac8 as 5.4",
|
||||||
"shlinkio/shlink-ip-geolocation": "^1.5",
|
"shlinkio/shlink-ip-geolocation": "^1.5",
|
||||||
"symfony/console": "^5.1",
|
"symfony/console": "^5.1",
|
||||||
|
@ -89,6 +89,7 @@ class ShortUrl extends AbstractEntity
|
|||||||
ShortUrlInputFilter::LONG_URL => $url->longUrl(),
|
ShortUrlInputFilter::LONG_URL => $url->longUrl(),
|
||||||
ShortUrlInputFilter::DOMAIN => $url->domain(),
|
ShortUrlInputFilter::DOMAIN => $url->domain(),
|
||||||
ShortUrlInputFilter::TAGS => $url->tags(),
|
ShortUrlInputFilter::TAGS => $url->tags(),
|
||||||
|
ShortUrlInputFilter::TITLE => $url->title(),
|
||||||
ShortUrlInputFilter::VALIDATE_URL => false,
|
ShortUrlInputFilter::VALIDATE_URL => false,
|
||||||
];
|
];
|
||||||
if ($importShortCode) {
|
if ($importShortCode) {
|
||||||
|
@ -418,7 +418,7 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
|
|||||||
public function importedShortUrlsAreSearchedAsExpected(): void
|
public function importedShortUrlsAreSearchedAsExpected(): void
|
||||||
{
|
{
|
||||||
$buildImported = static fn (string $shortCode, ?String $domain = null) =>
|
$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);
|
$shortUrlWithoutDomain = ShortUrl::fromImport($buildImported('my-cool-slug'), true);
|
||||||
$this->getEntityManager()->persist($shortUrlWithoutDomain);
|
$this->getEntityManager()->persist($shortUrlWithoutDomain);
|
||||||
|
@ -64,7 +64,7 @@ class ShortUrlTest extends TestCase
|
|||||||
{
|
{
|
||||||
yield 'no custom slug' => [ShortUrl::createEmpty()];
|
yield 'no custom slug' => [ShortUrl::createEmpty()];
|
||||||
yield 'imported with custom slug' => [
|
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),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ class ImportedLinksProcessorTest extends TestCase
|
|||||||
public function newUrlsWithNoErrorsAreAllPersisted(): void
|
public function newUrlsWithNoErrorsAreAllPersisted(): void
|
||||||
{
|
{
|
||||||
$urls = [
|
$urls = [
|
||||||
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo'),
|
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo', null),
|
||||||
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar'),
|
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar', 'foo'),
|
||||||
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz'),
|
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz', null),
|
||||||
];
|
];
|
||||||
$expectedCalls = count($urls);
|
$expectedCalls = count($urls);
|
||||||
|
|
||||||
@ -80,11 +80,11 @@ class ImportedLinksProcessorTest extends TestCase
|
|||||||
public function alreadyImportedUrlsAreSkipped(): void
|
public function alreadyImportedUrlsAreSkipped(): void
|
||||||
{
|
{
|
||||||
$urls = [
|
$urls = [
|
||||||
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo'),
|
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo', null),
|
||||||
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar'),
|
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar', null),
|
||||||
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz'),
|
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz', null),
|
||||||
new ImportedShlinkUrl('', 'baz2', [], Chronos::now(), null, 'baz2'),
|
new ImportedShlinkUrl('', 'baz2', [], Chronos::now(), null, 'baz2', null),
|
||||||
new ImportedShlinkUrl('', 'baz3', [], Chronos::now(), null, 'baz3'),
|
new ImportedShlinkUrl('', 'baz3', [], Chronos::now(), null, 'baz3', null),
|
||||||
];
|
];
|
||||||
$contains = fn (string $needle) => fn (string $text) => str_contains($text, $needle);
|
$contains = fn (string $needle) => fn (string $text) => str_contains($text, $needle);
|
||||||
|
|
||||||
@ -110,11 +110,11 @@ class ImportedLinksProcessorTest extends TestCase
|
|||||||
public function nonUniqueShortCodesAreAskedToUser(): void
|
public function nonUniqueShortCodesAreAskedToUser(): void
|
||||||
{
|
{
|
||||||
$urls = [
|
$urls = [
|
||||||
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo'),
|
new ImportedShlinkUrl('', 'foo', [], Chronos::now(), null, 'foo', null),
|
||||||
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar'),
|
new ImportedShlinkUrl('', 'bar', [], Chronos::now(), null, 'bar', null),
|
||||||
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz'),
|
new ImportedShlinkUrl('', 'baz', [], Chronos::now(), null, 'baz', 'foo'),
|
||||||
new ImportedShlinkUrl('', 'baz2', [], Chronos::now(), null, 'baz2'),
|
new ImportedShlinkUrl('', 'baz2', [], Chronos::now(), null, 'baz2', null),
|
||||||
new ImportedShlinkUrl('', 'baz3', [], Chronos::now(), null, 'baz3'),
|
new ImportedShlinkUrl('', 'baz3', [], Chronos::now(), null, 'baz3', 'bar'),
|
||||||
];
|
];
|
||||||
$contains = fn (string $needle) => fn (string $text) => str_contains($text, $needle);
|
$contains = fn (string $needle) => fn (string $text) => str_contains($text, $needle);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user