mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Remove dependencies on url_shortener raw config
This commit is contained in:
@@ -25,7 +25,7 @@ class EditShortUrlActionTest extends TestCase
|
||||
{
|
||||
$this->shortUrlService = $this->createMock(ShortUrlServiceInterface::class);
|
||||
$this->action = new EditShortUrlAction($this->shortUrlService, new ShortUrlDataTransformer(
|
||||
new ShortUrlStringifier([]),
|
||||
new ShortUrlStringifier(),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Paginator\Paginator;
|
||||
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifier;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlsParams;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\ShortUrlListServiceInterface;
|
||||
@@ -30,10 +31,10 @@ class ListShortUrlsActionTest extends TestCase
|
||||
$this->service = $this->createMock(ShortUrlListServiceInterface::class);
|
||||
|
||||
$this->action = new ListShortUrlsAction($this->service, new ShortUrlDataTransformer(
|
||||
new ShortUrlStringifier([
|
||||
new ShortUrlStringifier(new UrlShortenerOptions(domain: [
|
||||
'hostname' => 's.test',
|
||||
'schema' => 'https',
|
||||
]),
|
||||
])),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class ResolveShortUrlActionTest extends TestCase
|
||||
{
|
||||
$this->urlResolver = $this->createMock(ShortUrlResolverInterface::class);
|
||||
$this->action = new ResolveShortUrlAction($this->urlResolver, new ShortUrlDataTransformer(
|
||||
new ShortUrlStringifier([]),
|
||||
new ShortUrlStringifier(),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Paginator\Paginator;
|
||||
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
|
||||
use Shlinkio\Shlink\Core\Visit\Model\VisitsParams;
|
||||
use Shlinkio\Shlink\Core\Visit\VisitsStatsHelperInterface;
|
||||
use Shlinkio\Shlink\Rest\Action\Visit\DomainVisitsAction;
|
||||
@@ -24,7 +25,10 @@ class DomainVisitsActionTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->visitsHelper = $this->createMock(VisitsStatsHelperInterface::class);
|
||||
$this->action = new DomainVisitsAction($this->visitsHelper, 'the_default.com');
|
||||
$this->action = new DomainVisitsAction(
|
||||
$this->visitsHelper,
|
||||
new UrlShortenerOptions(domain: ['hostname' => 'the_default.com']),
|
||||
);
|
||||
}
|
||||
|
||||
#[Test, DataProvider('provideDomainAuthorities')]
|
||||
|
||||
@@ -13,6 +13,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Model\Validation\ShortUrlInputFilter;
|
||||
use Shlinkio\Shlink\Rest\Middleware\ShortUrl\DefaultShortCodesLengthMiddleware;
|
||||
|
||||
@@ -24,7 +25,7 @@ class DefaultShortCodesLengthMiddlewareTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->handler = $this->createMock(RequestHandlerInterface::class);
|
||||
$this->middleware = new DefaultShortCodesLengthMiddleware(8);
|
||||
$this->middleware = new DefaultShortCodesLengthMiddleware(new UrlShortenerOptions(defaultShortCodesLength: 8));
|
||||
}
|
||||
|
||||
#[Test, DataProvider('provideBodies')]
|
||||
|
||||
@@ -13,6 +13,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
|
||||
use Shlinkio\Shlink\Rest\Middleware\ShortUrl\DropDefaultDomainFromRequestMiddleware;
|
||||
|
||||
class DropDefaultDomainFromRequestMiddlewareTest extends TestCase
|
||||
@@ -23,7 +24,9 @@ class DropDefaultDomainFromRequestMiddlewareTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->next = $this->createMock(RequestHandlerInterface::class);
|
||||
$this->middleware = new DropDefaultDomainFromRequestMiddleware('s.test');
|
||||
$this->middleware = new DropDefaultDomainFromRequestMiddleware(
|
||||
new UrlShortenerOptions(domain: ['hostname' => 's.test']),
|
||||
);
|
||||
}
|
||||
|
||||
#[Test, DataProvider('provideQueryParams')]
|
||||
|
||||
Reference in New Issue
Block a user