diff --git a/data/migrations/Version20180913205455.php b/data/migrations/Version20180913205455.php index 0b012ca1..0b2b60d9 100644 --- a/data/migrations/Version20180913205455.php +++ b/data/migrations/Version20180913205455.php @@ -7,8 +7,8 @@ use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; use PDO; -use Shlinkio\Shlink\Common\Exception\WrongIpException; use Shlinkio\Shlink\Common\Util\IpAddress; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; /** * Auto-generated Migration: Please modify to your needs! diff --git a/module/CLI/src/Command/Visit/LocateVisitsCommand.php b/module/CLI/src/Command/Visit/LocateVisitsCommand.php index cbaf2118..d59ead2a 100644 --- a/module/CLI/src/Command/Visit/LocateVisitsCommand.php +++ b/module/CLI/src/Command/Visit/LocateVisitsCommand.php @@ -9,12 +9,12 @@ use Shlinkio\Shlink\CLI\Command\Util\LockedCommandConfig; use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException; use Shlinkio\Shlink\CLI\Util\ExitCodes; use Shlinkio\Shlink\CLI\Util\GeolocationDbUpdaterInterface; -use Shlinkio\Shlink\Common\Exception\WrongIpException; use Shlinkio\Shlink\Common\Util\IpAddress; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException; use Shlinkio\Shlink\Core\Service\VisitServiceInterface; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; use Symfony\Component\Console\Helper\ProgressBar; diff --git a/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php b/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php index 0ce1a5bf..41a1a8fa 100644 --- a/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php +++ b/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php @@ -9,13 +9,13 @@ use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\CLI\Command\Visit\LocateVisitsCommand; use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException; use Shlinkio\Shlink\CLI\Util\GeolocationDbUpdaterInterface; -use Shlinkio\Shlink\Common\Exception\WrongIpException; use Shlinkio\Shlink\Common\Util\IpAddress; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; use Shlinkio\Shlink\Core\Model\Visitor; use Shlinkio\Shlink\Core\Service\VisitService; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; use Shlinkio\Shlink\IpGeolocation\Resolver\IpApiLocationResolver; use Symfony\Component\Console\Application; diff --git a/module/Common/src/Util/IpAddress.php b/module/Common/src/Util/IpAddress.php index 8521f9be..c237cd15 100644 --- a/module/Common/src/Util/IpAddress.php +++ b/module/Common/src/Util/IpAddress.php @@ -3,7 +3,7 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Common\Util; -use Shlinkio\Shlink\Common\Exception\WrongIpException; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use function count; use function explode; diff --git a/module/Core/src/Entity/Visit.php b/module/Core/src/Entity/Visit.php index 58401088..a6e87bad 100644 --- a/module/Core/src/Entity/Visit.php +++ b/module/Core/src/Entity/Visit.php @@ -6,11 +6,11 @@ namespace Shlinkio\Shlink\Core\Entity; use Cake\Chronos\Chronos; use JsonSerializable; use Shlinkio\Shlink\Common\Entity\AbstractEntity; -use Shlinkio\Shlink\Common\Exception\WrongIpException; use Shlinkio\Shlink\Common\Util\IpAddress; use Shlinkio\Shlink\Core\Model\Visitor; use Shlinkio\Shlink\Core\Visit\Model\UnknownVisitLocation; use Shlinkio\Shlink\Core\Visit\Model\VisitLocationInterface; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; class Visit extends AbstractEntity implements JsonSerializable { diff --git a/module/Core/src/EventDispatcher/LocateShortUrlVisit.php b/module/Core/src/EventDispatcher/LocateShortUrlVisit.php index e0a0f274..b0eb5107 100644 --- a/module/Core/src/EventDispatcher/LocateShortUrlVisit.php +++ b/module/Core/src/EventDispatcher/LocateShortUrlVisit.php @@ -7,9 +7,9 @@ use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException; use Shlinkio\Shlink\CLI\Util\GeolocationDbUpdaterInterface; -use Shlinkio\Shlink\Common\Exception\WrongIpException; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; diff --git a/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php b/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php index 5c10406c..966c02a8 100644 --- a/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php +++ b/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php @@ -10,7 +10,6 @@ use Prophecy\Prophecy\ObjectProphecy; use Psr\Log\LoggerInterface; use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException; use Shlinkio\Shlink\CLI\Util\GeolocationDbUpdaterInterface; -use Shlinkio\Shlink\Common\Exception\WrongIpException; use Shlinkio\Shlink\Common\Util\IpAddress; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\Visit; @@ -19,6 +18,7 @@ use Shlinkio\Shlink\Core\EventDispatcher\LocateShortUrlVisit; use Shlinkio\Shlink\Core\EventDispatcher\ShortUrlVisited; use Shlinkio\Shlink\Core\Model\Visitor; use Shlinkio\Shlink\Core\Visit\Model\UnknownVisitLocation; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; diff --git a/module/IpGeolocation/src/Exception/ExceptionInterface.php b/module/IpGeolocation/src/Exception/ExceptionInterface.php new file mode 100644 index 00000000..12b2ccdc --- /dev/null +++ b/module/IpGeolocation/src/Exception/ExceptionInterface.php @@ -0,0 +1,10 @@ +assertEquals(0, $e->getCode()); $this->assertNull($e->getPrevious()); } + /** @test */ - public function fromIpAddressProperlyCreatesExceptionWithPrev() + public function fromIpAddressProperlyCreatesExceptionWithPrev(): void { $prev = new Exception('Previous error'); $e = WrongIpException::fromIpAddress('1.2.3.4', $prev); diff --git a/module/IpGeolocation/test/Resolver/ChainIpLocationResolverTest.php b/module/IpGeolocation/test/Resolver/ChainIpLocationResolverTest.php index 34e5100c..a95b60c0 100644 --- a/module/IpGeolocation/test/Resolver/ChainIpLocationResolverTest.php +++ b/module/IpGeolocation/test/Resolver/ChainIpLocationResolverTest.php @@ -5,7 +5,7 @@ namespace ShlinkioTest\Shlink\IpGeolocation\Resolver; use PHPUnit\Framework\TestCase; use Prophecy\Prophecy\ObjectProphecy; -use Shlinkio\Shlink\Common\Exception\WrongIpException; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; use Shlinkio\Shlink\IpGeolocation\Resolver\ChainIpLocationResolver; use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; diff --git a/module/IpGeolocation/test/Resolver/GeoLite2LocationResolverTest.php b/module/IpGeolocation/test/Resolver/GeoLite2LocationResolverTest.php index 66122796..806f2759 100644 --- a/module/IpGeolocation/test/Resolver/GeoLite2LocationResolverTest.php +++ b/module/IpGeolocation/test/Resolver/GeoLite2LocationResolverTest.php @@ -9,7 +9,7 @@ use GeoIp2\Model\City; use MaxMind\Db\Reader\InvalidDatabaseException; use PHPUnit\Framework\TestCase; use Prophecy\Prophecy\ObjectProphecy; -use Shlinkio\Shlink\Common\Exception\WrongIpException; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; use Shlinkio\Shlink\IpGeolocation\Resolver\GeoLite2LocationResolver; diff --git a/module/IpGeolocation/test/Resolver/IpApiLocationResolverTest.php b/module/IpGeolocation/test/Resolver/IpApiLocationResolverTest.php index 7e0425de..a87edf98 100644 --- a/module/IpGeolocation/test/Resolver/IpApiLocationResolverTest.php +++ b/module/IpGeolocation/test/Resolver/IpApiLocationResolverTest.php @@ -8,7 +8,7 @@ use GuzzleHttp\Exception\TransferException; use GuzzleHttp\Psr7\Response; use PHPUnit\Framework\TestCase; use Prophecy\Prophecy\ObjectProphecy; -use Shlinkio\Shlink\Common\Exception\WrongIpException; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; use Shlinkio\Shlink\IpGeolocation\Resolver\IpApiLocationResolver; diff --git a/module/Rest/test/Util/RestUtilsTest.php b/module/Rest/test/Util/RestUtilsTest.php index 0f3ab4ff..fd5578ca 100644 --- a/module/Rest/test/Util/RestUtilsTest.php +++ b/module/Rest/test/Util/RestUtilsTest.php @@ -5,9 +5,9 @@ namespace ShlinkioTest\Shlink\Rest\Util; use PHPUnit\Framework\TestCase; use Shlinkio\Shlink\Common\Exception\InvalidArgumentException; -use Shlinkio\Shlink\Common\Exception\WrongIpException; use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException; use Shlinkio\Shlink\Core\Exception\InvalidUrlException; +use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\Rest\Exception\AuthenticationException; use Shlinkio\Shlink\Rest\Util\RestUtils;