Updated ImportedLinksProcessor to support importing visits if provided

This commit is contained in:
Alejandro Celaya
2021-04-10 23:24:01 +02:00
parent e23cd6a856
commit 1efa973507
13 changed files with 132 additions and 70 deletions

View File

@@ -17,7 +17,7 @@ class VisitLocationTest extends TestCase
public function isEmptyReturnsTrueWhenAllValuesAreEmpty(array $args, bool $isEmpty): void
{
$payload = new Location(...$args);
$location = new VisitLocation($payload);
$location = VisitLocation::fromGeolocation($payload);
self::assertEquals($isEmpty, $location->isEmpty());
}

View File

@@ -168,7 +168,7 @@ class LocateVisitTest extends TestCase
($this->locateVisit)($event);
self::assertEquals($visit->getVisitLocation(), new VisitLocation(Location::emptyInstance()));
self::assertEquals($visit->getVisitLocation(), VisitLocation::fromGeolocation(Location::emptyInstance()));
$findVisit->shouldHaveBeenCalledOnce();
$flush->shouldHaveBeenCalledOnce();
$resolveIp->shouldNotHaveBeenCalled();
@@ -204,7 +204,7 @@ class LocateVisitTest extends TestCase
($this->locateVisit)($event);
self::assertEquals($visit->getVisitLocation(), new VisitLocation($location));
self::assertEquals($visit->getVisitLocation(), VisitLocation::fromGeolocation($location));
$findVisit->shouldHaveBeenCalledOnce();
$flush->shouldHaveBeenCalledOnce();
$resolveIp->shouldHaveBeenCalledOnce();

View File

@@ -68,7 +68,7 @@ class OrphanVisitDataTransformerTest extends TestCase
->withHeader('Referer', 'referer')
->withUri(new Uri('https://doma.in/foo/bar')),
),
)->locate($location = new VisitLocation(Location::emptyInstance())),
)->locate($location = VisitLocation::fromGeolocation(Location::emptyInstance())),
[
'referer' => 'referer',
'date' => $visit->getDate()->toAtomString(),