mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 09:43:13 +08:00
Remove dependencies on url_shortener raw config
This commit is contained in:
@@ -17,6 +17,7 @@ use Psr\Log\NullLogger;
|
||||
use Shlinkio\Shlink\Common\Response\QrCodeResponse;
|
||||
use Shlinkio\Shlink\Core\Action\QrCodeAction;
|
||||
use Shlinkio\Shlink\Core\Config\Options\QrCodeOptions;
|
||||
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
|
||||
use Shlinkio\Shlink\Core\Exception\ShortUrlNotFoundException;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifier;
|
||||
@@ -324,7 +325,7 @@ class QrCodeActionTest extends TestCase
|
||||
{
|
||||
return new QrCodeAction(
|
||||
$this->urlResolver,
|
||||
new ShortUrlStringifier(['domain' => 's.test']),
|
||||
new ShortUrlStringifier(),
|
||||
new NullLogger(),
|
||||
$options ?? new QrCodeOptions(enabledForDisabledShortUrls: false),
|
||||
);
|
||||
|
||||
@@ -11,6 +11,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Core\Config\EmptyNotFoundRedirectConfig;
|
||||
use Shlinkio\Shlink\Core\Config\NotFoundRedirects;
|
||||
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
|
||||
use Shlinkio\Shlink\Core\Domain\DomainService;
|
||||
use Shlinkio\Shlink\Core\Domain\Entity\Domain;
|
||||
use Shlinkio\Shlink\Core\Domain\Model\DomainItem;
|
||||
@@ -28,7 +29,10 @@ class DomainServiceTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->em = $this->createMock(EntityManagerInterface::class);
|
||||
$this->domainService = new DomainService($this->em, 'default.com');
|
||||
$this->domainService = new DomainService(
|
||||
$this->em,
|
||||
new UrlShortenerOptions(domain: ['hostname' => 'default.com']),
|
||||
);
|
||||
}
|
||||
|
||||
#[Test, DataProvider('provideExcludedDomains')]
|
||||
|
||||
@@ -31,7 +31,7 @@ class PublishingUpdatesGeneratorTest extends TestCase
|
||||
Chronos::setTestNow($this->now);
|
||||
|
||||
$this->generator = new PublishingUpdatesGenerator(
|
||||
new ShortUrlDataTransformer(new ShortUrlStringifier([])),
|
||||
new ShortUrlDataTransformer(new ShortUrlStringifier()),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Util\DateRange;
|
||||
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
|
||||
use Shlinkio\Shlink\Core\Matomo\MatomoTrackerBuilderInterface;
|
||||
use Shlinkio\Shlink\Core\Matomo\MatomoVisitSender;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
|
||||
@@ -36,7 +37,7 @@ class MatomoVisitSenderTest extends TestCase
|
||||
|
||||
$this->visitSender = new MatomoVisitSender(
|
||||
$this->trackerBuilder,
|
||||
new ShortUrlStringifier(['hostname' => 's2.test']),
|
||||
new ShortUrlStringifier(new UrlShortenerOptions(domain: ['hostname' => 's2.test'])),
|
||||
$this->visitIterationRepository,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Core\ShortUrl\Helper;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifier;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlCreation;
|
||||
@@ -15,12 +16,12 @@ class ShortUrlStringifierTest extends TestCase
|
||||
{
|
||||
#[Test, DataProvider('provideConfigAndShortUrls')]
|
||||
public function generatesExpectedOutputBasedOnConfigAndShortUrl(
|
||||
array $config,
|
||||
array $domainConfig,
|
||||
string $basePath,
|
||||
ShortUrl $shortUrl,
|
||||
string $expected,
|
||||
): void {
|
||||
$stringifier = new ShortUrlStringifier($config, $basePath);
|
||||
$stringifier = new ShortUrlStringifier(new UrlShortenerOptions($domainConfig), $basePath);
|
||||
|
||||
self::assertEquals($expected, $stringifier->stringify($shortUrl));
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class ShortUrlDataTransformerTest extends TestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->transformer = new ShortUrlDataTransformer(new ShortUrlStringifier([]));
|
||||
$this->transformer = new ShortUrlDataTransformer(new ShortUrlStringifier());
|
||||
}
|
||||
|
||||
#[Test, DataProvider('provideShortUrls')]
|
||||
|
||||
Reference in New Issue
Block a user