mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Split some logic from VisitRepository into its own injectable repository
This commit is contained in:
@@ -15,7 +15,7 @@ use Shlinkio\Shlink\Core\Visit\Entity\VisitLocation;
|
||||
use Shlinkio\Shlink\Core\Visit\Geolocation\VisitGeolocationHelperInterface;
|
||||
use Shlinkio\Shlink\Core\Visit\Geolocation\VisitLocator;
|
||||
use Shlinkio\Shlink\Core\Visit\Model\Visitor;
|
||||
use Shlinkio\Shlink\Core\Visit\Repository\VisitRepositoryInterface;
|
||||
use Shlinkio\Shlink\Core\Visit\Repository\VisitLocationRepositoryInterface;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model\Location;
|
||||
|
||||
use function count;
|
||||
@@ -28,15 +28,14 @@ class VisitLocatorTest extends TestCase
|
||||
{
|
||||
private VisitLocator $visitService;
|
||||
private MockObject & EntityManager $em;
|
||||
private MockObject & VisitRepositoryInterface $repo;
|
||||
private MockObject & VisitLocationRepositoryInterface $repo;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->em = $this->createMock(EntityManager::class);
|
||||
$this->repo = $this->createMock(VisitRepositoryInterface::class);
|
||||
$this->em->method('getRepository')->with(Visit::class)->willReturn($this->repo);
|
||||
$this->repo = $this->createMock(VisitLocationRepositoryInterface::class);
|
||||
|
||||
$this->visitService = new VisitLocator($this->em);
|
||||
$this->visitService = new VisitLocator($this->em, $this->repo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +102,7 @@ class VisitLocatorTest extends TestCase
|
||||
|
||||
$this->visitService->{$serviceMethodName}(
|
||||
new class ($isNonLocatableAddress) implements VisitGeolocationHelperInterface {
|
||||
public function __construct(private bool $isNonLocatableAddress)
|
||||
public function __construct(private readonly bool $isNonLocatableAddress)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user