Refactored short URL creation so that the long URL is part of the ShortUrlMeta

This commit is contained in:
Alejandro Celaya
2021-01-30 14:18:44 +01:00
parent 56a2253535
commit 07b12fac3c
45 changed files with 343 additions and 306 deletions

View File

@@ -57,7 +57,7 @@ class VisitLocatorTest extends TestCase
): void {
$unlocatedVisits = map(
range(1, 200),
fn (int $i) => new Visit(new ShortUrl(sprintf('short_code_%s', $i)), Visitor::emptyInstance()),
fn (int $i) => new Visit(ShortUrl::withLongUrl(sprintf('short_code_%s', $i)), Visitor::emptyInstance()),
);
$findVisits = $this->mockRepoMethod($expectedRepoMethodName)->willReturn($unlocatedVisits);
@@ -107,7 +107,7 @@ class VisitLocatorTest extends TestCase
bool $isNonLocatableAddress
): void {
$unlocatedVisits = [
new Visit(new ShortUrl('foo'), Visitor::emptyInstance()),
new Visit(ShortUrl::withLongUrl('foo'), Visitor::emptyInstance()),
];
$findVisits = $this->mockRepoMethod($expectedRepoMethodName)->willReturn($unlocatedVisits);