From 1bcd03b15036d1fed82e50d28359aa3fd72ad57e Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 17 Feb 2019 13:21:07 +0100 Subject: [PATCH] Renamed method --- module/CLI/src/Command/Visit/ProcessVisitsCommand.php | 2 +- .../CLI/test/Command/Visit/ProcessVisitsCommandTest.php | 8 ++++---- module/Core/src/Service/VisitService.php | 2 +- module/Core/src/Service/VisitServiceInterface.php | 2 +- module/Core/test/Service/VisitServiceTest.php | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/module/CLI/src/Command/Visit/ProcessVisitsCommand.php b/module/CLI/src/Command/Visit/ProcessVisitsCommand.php index f5b2efde..25006cc9 100644 --- a/module/CLI/src/Command/Visit/ProcessVisitsCommand.php +++ b/module/CLI/src/Command/Visit/ProcessVisitsCommand.php @@ -62,7 +62,7 @@ class ProcessVisitsCommand extends Command } try { - $this->visitService->locateVisits( + $this->visitService->locateUnlocatedVisits( [$this, 'getGeolocationDataForVisit'], function (VisitLocation $location) use ($output) { $output->writeln(sprintf(' [Address located at "%s"]', $location->getCountryName())); diff --git a/module/CLI/test/Command/Visit/ProcessVisitsCommandTest.php b/module/CLI/test/Command/Visit/ProcessVisitsCommandTest.php index 7d4e015b..f0951715 100644 --- a/module/CLI/test/Command/Visit/ProcessVisitsCommandTest.php +++ b/module/CLI/test/Command/Visit/ProcessVisitsCommandTest.php @@ -65,7 +65,7 @@ class ProcessVisitsCommandTest extends TestCase $visit = new Visit(new ShortUrl(''), new Visitor('', '', '1.2.3.4')); $location = new VisitLocation(Location::emptyInstance()); - $locateVisits = $this->visitService->locateVisits(Argument::cetera())->will( + $locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will( function (array $args) use ($visit, $location) { $firstCallback = array_shift($args); $firstCallback($visit); @@ -97,7 +97,7 @@ class ProcessVisitsCommandTest extends TestCase $visit = new Visit(new ShortUrl(''), new Visitor('', '', $address)); $location = new VisitLocation(Location::emptyInstance()); - $locateVisits = $this->visitService->locateVisits(Argument::cetera())->will( + $locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will( function (array $args) use ($visit, $location) { $firstCallback = array_shift($args); $firstCallback($visit); @@ -133,7 +133,7 @@ class ProcessVisitsCommandTest extends TestCase $visit = new Visit(new ShortUrl(''), new Visitor('', '', '1.2.3.4')); $location = new VisitLocation(Location::emptyInstance()); - $locateVisits = $this->visitService->locateVisits(Argument::cetera())->will( + $locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will( function (array $args) use ($visit, $location) { $firstCallback = array_shift($args); $firstCallback($visit); @@ -162,7 +162,7 @@ class ProcessVisitsCommandTest extends TestCase { $this->lock->acquire()->willReturn(false); - $locateVisits = $this->visitService->locateVisits(Argument::cetera())->will(function () { + $locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will(function () { }); $resolveIpLocation = $this->ipResolver->resolveIpLocation(Argument::any())->willReturn([]); diff --git a/module/Core/src/Service/VisitService.php b/module/Core/src/Service/VisitService.php index a56a4b7c..705dab59 100644 --- a/module/Core/src/Service/VisitService.php +++ b/module/Core/src/Service/VisitService.php @@ -20,7 +20,7 @@ class VisitService implements VisitServiceInterface $this->em = $em; } - public function locateVisits(callable $geolocateVisit, ?callable $notifyVisitWithLocation = null): void + public function locateUnlocatedVisits(callable $geolocateVisit, ?callable $notifyVisitWithLocation = null): void { /** @var VisitRepository $repo */ $repo = $this->em->getRepository(Visit::class); diff --git a/module/Core/src/Service/VisitServiceInterface.php b/module/Core/src/Service/VisitServiceInterface.php index 23dd273d..089567d2 100644 --- a/module/Core/src/Service/VisitServiceInterface.php +++ b/module/Core/src/Service/VisitServiceInterface.php @@ -5,5 +5,5 @@ namespace Shlinkio\Shlink\Core\Service; interface VisitServiceInterface { - public function locateVisits(callable $geolocateVisit, ?callable $notifyVisitWithLocation = null): void; + public function locateUnlocatedVisits(callable $geolocateVisit, ?callable $notifyVisitWithLocation = null): void; } diff --git a/module/Core/test/Service/VisitServiceTest.php b/module/Core/test/Service/VisitServiceTest.php index 0fd1da79..cf5a8881 100644 --- a/module/Core/test/Service/VisitServiceTest.php +++ b/module/Core/test/Service/VisitServiceTest.php @@ -51,7 +51,7 @@ class VisitServiceTest extends TestCase $clear = $this->em->clear()->will(function () { }); - $this->visitService->locateVisits(function () { + $this->visitService->locateUnlocatedVisits(function () { return Location::emptyInstance(); }, function () { $args = func_get_args(); @@ -87,7 +87,7 @@ class VisitServiceTest extends TestCase $clear = $this->em->clear()->will(function () { }); - $this->visitService->locateVisits(function () { + $this->visitService->locateUnlocatedVisits(function () { throw new IpCannotBeLocatedException('Cannot be located'); });