Updated to readonly public props on as many models as possible

This commit is contained in:
Alejandro Celaya
2022-04-23 14:00:47 +02:00
parent e79391907a
commit bca3e62ced
74 changed files with 249 additions and 494 deletions

View File

@@ -44,9 +44,9 @@ class DomainRedirectsRequestTest extends TestCase
$notFound = $request->toNotFoundRedirects($defaults);
self::assertEquals($expectedAuthority, $request->authority());
self::assertEquals($expectedBaseUrlRedirect, $notFound->baseUrlRedirect());
self::assertEquals($expectedRegular404Redirect, $notFound->regular404Redirect());
self::assertEquals($expectedInvalidShortUrlRedirect, $notFound->invalidShortUrlRedirect());
self::assertEquals($expectedBaseUrlRedirect, $notFound->baseUrlRedirect);
self::assertEquals($expectedRegular404Redirect, $notFound->regular404Redirect);
self::assertEquals($expectedInvalidShortUrlRedirect, $notFound->invalidShortUrlRedirect);
}
public function provideValidData(): iterable

View File

@@ -36,9 +36,11 @@ class ResolveShortUrlActionTest extends TestCase
{
$shortCode = 'abc123';
$apiKey = ApiKey::create();
$this->urlResolver->resolveShortUrl(new ShortUrlIdentifier($shortCode), $apiKey)->willReturn(
ShortUrl::withLongUrl('http://domain.com/foo/bar'),
)->shouldBeCalledOnce();
$this->urlResolver->resolveShortUrl(
ShortUrlIdentifier::fromShortCodeAndDomain($shortCode),
$apiKey,
)->willReturn(ShortUrl::withLongUrl('http://domain.com/foo/bar'))
->shouldBeCalledOnce();
$request = (new ServerRequest())->withAttribute('shortCode', $shortCode)->withAttribute(ApiKey::class, $apiKey);
$response = $this->action->handle($request);

View File

@@ -38,7 +38,7 @@ class ShortUrlVisitsActionTest extends TestCase
{
$shortCode = 'abc123';
$this->visitsHelper->visitsForShortUrl(
new ShortUrlIdentifier($shortCode),
ShortUrlIdentifier::fromShortCodeAndDomain($shortCode),
Argument::type(VisitsParams::class),
Argument::type(ApiKey::class),
)->willReturn(new Paginator(new ArrayAdapter([])))
@@ -52,7 +52,7 @@ class ShortUrlVisitsActionTest extends TestCase
public function paramsAreReadFromQuery(): void
{
$shortCode = 'abc123';
$this->visitsHelper->visitsForShortUrl(new ShortUrlIdentifier($shortCode), new VisitsParams(
$this->visitsHelper->visitsForShortUrl(ShortUrlIdentifier::fromShortCodeAndDomain($shortCode), new VisitsParams(
DateRange::withEndDate(Chronos::parse('2016-01-01 00:00:00')),
3,
10,