Update dependencies

This commit is contained in:
Alejandro Celaya 2023-08-19 11:48:04 +02:00
parent aa4b9fc27e
commit b747b8448e
16 changed files with 50 additions and 50 deletions

View File

@ -18,30 +18,30 @@
"ext-json": "*", "ext-json": "*",
"ext-pdo": "*", "ext-pdo": "*",
"akrabat/ip-address-middleware": "^2.1", "akrabat/ip-address-middleware": "^2.1",
"cakephp/chronos": "^2.3", "cakephp/chronos": "^2.4",
"doctrine/migrations": "^3.5", "doctrine/migrations": "^3.6",
"doctrine/orm": "^2.14", "doctrine/orm": "^2.16",
"endroid/qr-code": "^4.7", "endroid/qr-code": "^4.8",
"friendsofphp/proxy-manager-lts": "^1.0",
"geoip2/geoip2": "^2.13", "geoip2/geoip2": "^2.13",
"guzzlehttp/guzzle": "^7.5", "guzzlehttp/guzzle": "^7.5",
"happyr/doctrine-specification": "^2.0", "happyr/doctrine-specification": "^2.0",
"jaybizzle/crawler-detect": "^1.2.112", "jaybizzle/crawler-detect": "^1.2.116",
"laminas/laminas-config": "^3.8", "laminas/laminas-config": "^3.8",
"laminas/laminas-config-aggregator": "^1.13", "laminas/laminas-config-aggregator": "^1.13",
"laminas/laminas-diactoros": "^2.24", "laminas/laminas-diactoros": "^2.25",
"laminas/laminas-inputfilter": "^2.24", "laminas/laminas-inputfilter": "^2.27",
"laminas/laminas-servicemanager": "^3.21", "laminas/laminas-servicemanager": "^3.21",
"laminas/laminas-stdlib": "^3.16", "laminas/laminas-stdlib": "^3.17",
"league/uri": "^6.8", "league/uri": "^6.8",
"lstrojny/functional-php": "^1.17", "lstrojny/functional-php": "^1.17",
"mezzio/mezzio": "^3.15", "mezzio/mezzio": "^3.17",
"mezzio/mezzio-fastroute": "^3.8", "mezzio/mezzio-fastroute": "^3.10",
"mezzio/mezzio-problem-details": "^1.11", "mezzio/mezzio-problem-details": "^1.12",
"mezzio/mezzio-swoole": "^4.6", "mezzio/mezzio-swoole": "^4.7",
"mlocati/ip-lib": "^1.18", "mlocati/ip-lib": "^1.18",
"mobiledetect/mobiledetectlib": "^3.74", "mobiledetect/mobiledetectlib": "^3.74",
"ocramius/proxy-manager": "^2.14", "pagerfanta/core": "^3.8",
"pagerfanta/core": "^3.7",
"php-middleware/request-id": "^4.1", "php-middleware/request-id": "^4.1",
"pugx/shortid-php": "^1.1", "pugx/shortid-php": "^1.1",
"ramsey/uuid": "^4.7", "ramsey/uuid": "^4.7",
@ -52,15 +52,15 @@
"shlinkio/shlink-installer": "dev-develop#b393e6b as 8.5", "shlinkio/shlink-installer": "dev-develop#b393e6b as 8.5",
"shlinkio/shlink-ip-geolocation": "^3.2", "shlinkio/shlink-ip-geolocation": "^3.2",
"shlinkio/shlink-json": "^1.0", "shlinkio/shlink-json": "^1.0",
"spiral/roadrunner": "^2023.1", "spiral/roadrunner": "^2023.2",
"spiral/roadrunner-cli": "^2.5", "spiral/roadrunner-cli": "^2.5",
"spiral/roadrunner-http": "^3.0", "spiral/roadrunner-http": "^3.1",
"spiral/roadrunner-jobs": "^4.0", "spiral/roadrunner-jobs": "^4.0",
"symfony/console": "^6.2", "symfony/console": "^6.3",
"symfony/filesystem": "^6.2", "symfony/filesystem": "^6.3",
"symfony/lock": "^6.2", "symfony/lock": "^6.3",
"symfony/process": "^6.2", "symfony/process": "^6.3",
"symfony/string": "^6.2" "symfony/string": "^6.3"
}, },
"require-dev": { "require-dev": {
"devizzent/cebe-php-openapi": "^1.0.1", "devizzent/cebe-php-openapi": "^1.0.1",
@ -71,12 +71,12 @@
"phpstan/phpstan-doctrine": "^1.3", "phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-symfony": "^1.3", "phpstan/phpstan-symfony": "^1.3",
"phpunit/php-code-coverage": "^10.0", "phpunit/php-code-coverage": "^10.1",
"phpunit/phpunit": "^10.2.0", "phpunit/phpunit": "^10.3",
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.3.0", "shlinkio/php-coding-standard": "~2.3.0",
"shlinkio/shlink-test-utils": "^3.7.1", "shlinkio/shlink-test-utils": "^3.7.1",
"symfony/var-dumper": "^6.2", "symfony/var-dumper": "^6.3",
"veewee/composer-run-parallel": "^1.2" "veewee/composer-run-parallel": "^1.2"
}, },
"autoload": { "autoload": {

View File

@ -70,7 +70,7 @@ class GeolocationDbUpdater implements GeolocationDbUpdaterInterface
$buildTimestamp = $this->resolveBuildTimestamp($meta); $buildTimestamp = $this->resolveBuildTimestamp($meta);
$buildDate = Chronos::createFromTimestamp($buildTimestamp); $buildDate = Chronos::createFromTimestamp($buildTimestamp);
return Chronos::now()->gt($buildDate->addDays(35)); return Chronos::now()->greaterThan($buildDate->addDays(35));
} }
private function resolveBuildTimestamp(Metadata $meta): int private function resolveBuildTimestamp(Metadata $meta): int

View File

@ -24,7 +24,7 @@ class ListApiKeysTest extends CliTestCase
public static function provideFlags(): iterable public static function provideFlags(): iterable
{ {
$expiredApiKeyDate = Chronos::now()->subDay()->startOfDay()->toAtomString(); $expiredApiKeyDate = Chronos::now()->subDays(1)->startOfDay()->toAtomString();
$enabledOnlyOutput = <<<OUT $enabledOnlyOutput = <<<OUT
+--------------------+------+---------------------------+--------------------------+ +--------------------+------+---------------------------+--------------------------+
| Key | Name | Expiration date | Roles | | Key | Name | Expiration date | Roles |

View File

@ -5,7 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Util; namespace ShlinkioTest\Shlink\CLI\Util;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use PHPUnit\Framework\MockObject\Generator; use PHPUnit\Framework\MockObject\Generator\Generator;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;

View File

@ -139,7 +139,7 @@ class ImportedLinksProcessor implements ImportedLinksProcessorInterface
$importedVisits = 0; $importedVisits = 0;
foreach ($iterable as $importedOrphanVisit) { foreach ($iterable as $importedOrphanVisit) {
// Skip visits which are older than the most recent already imported visit's date // Skip visits which are older than the most recent already imported visit's date
if ($mostRecentOrphanVisit?->getDate()->gte(normalizeDate($importedOrphanVisit->date))) { if ($mostRecentOrphanVisit?->getDate()->greaterThanOrEquals(normalizeDate($importedOrphanVisit->date))) {
continue; continue;
} }

View File

@ -38,7 +38,7 @@ final class ShortUrlImporting
$importedVisits = 0; $importedVisits = 0;
foreach ($visits as $importedVisit) { foreach ($visits as $importedVisit) {
// Skip visits which are older than the most recent already imported visit's date // Skip visits which are older than the most recent already imported visit's date
if ($mostRecentImportedDate?->gte(normalizeDate($importedVisit->date))) { if ($mostRecentImportedDate?->greaterThanOrEquals(normalizeDate($importedVisit->date))) {
continue; continue;
} }

View File

@ -319,12 +319,12 @@ class ShortUrl extends AbstractEntity
} }
$now = Chronos::now(); $now = Chronos::now();
$beforeValidSince = $this->validSince !== null && $this->validSince->gt($now); $beforeValidSince = $this->validSince !== null && $this->validSince->greaterThan($now);
if ($beforeValidSince) { if ($beforeValidSince) {
return false; return false;
} }
$afterValidUntil = $this->validUntil !== null && $this->validUntil->lt($now); $afterValidUntil = $this->validUntil !== null && $this->validUntil->lessThan($now);
if ($afterValidUntil) { if ($afterValidUntil) {
return false; return false;
} }

View File

@ -307,9 +307,9 @@ class ImportedLinksProcessorTest extends TestCase
yield 'existing orphan visit' => [true, [ yield 'existing orphan visit' => [true, [
new ImportedShlinkOrphanVisit('', '', Chronos::now()->subDays(3), '', '', null), new ImportedShlinkOrphanVisit('', '', Chronos::now()->subDays(3), '', '', null),
new ImportedShlinkOrphanVisit('', '', Chronos::now()->subDays(2), '', '', null), new ImportedShlinkOrphanVisit('', '', Chronos::now()->subDays(2), '', '', null),
new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDay(), '', '', null), new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDays(1), '', '', null),
new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDay(), '', '', null), new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDays(1), '', '', null),
new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDay(), '', '', null), new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDays(1), '', '', null),
], Visit::forBasePath(Visitor::botInstance()), 3]; ], Visit::forBasePath(Visitor::botInstance()), 3];
} }

View File

@ -121,15 +121,15 @@ class ShortUrlResolverTest extends TestCase
return $shortUrl; return $shortUrl;
})()]; })()];
yield 'future validSince' => [ShortUrl::create(ShortUrlCreation::fromRawData( yield 'future validSince' => [ShortUrl::create(ShortUrlCreation::fromRawData(
['validSince' => $now->addMonth()->toAtomString(), 'longUrl' => 'https://longUrl'], ['validSince' => $now->addMonths(1)->toAtomString(), 'longUrl' => 'https://longUrl'],
))]; ))];
yield 'past validUntil' => [ShortUrl::create(ShortUrlCreation::fromRawData( yield 'past validUntil' => [ShortUrl::create(ShortUrlCreation::fromRawData(
['validUntil' => $now->subMonth()->toAtomString(), 'longUrl' => 'https://longUrl'], ['validUntil' => $now->subMonths(1)->toAtomString(), 'longUrl' => 'https://longUrl'],
))]; ))];
yield 'mixed' => [(function () use ($now) { yield 'mixed' => [(function () use ($now) {
$shortUrl = ShortUrl::create(ShortUrlCreation::fromRawData([ $shortUrl = ShortUrl::create(ShortUrlCreation::fromRawData([
'maxVisits' => 3, 'maxVisits' => 3,
'validUntil' => $now->subMonth()->toAtomString(), 'validUntil' => $now->subMonths(1)->toAtomString(),
'longUrl' => 'https://longUrl', 'longUrl' => 'https://longUrl',
])); ]));
$shortUrl->setVisits(new ArrayCollection(map( $shortUrl->setVisits(new ArrayCollection(map(

View File

@ -65,7 +65,7 @@ class ApiKey extends AbstractEntity
public function isExpired(): bool public function isExpired(): bool
{ {
return $this->expirationDate !== null && $this->expirationDate->lt(Chronos::now()); return $this->expirationDate !== null && $this->expirationDate->lessThan(Chronos::now());
} }
public function name(): ?string public function name(): ?string

View File

@ -115,7 +115,7 @@ class CreateShortUrlTest extends ApiTestCase
public function createsShortUrlWithValidSince(): void public function createsShortUrlWithValidSince(): void
{ {
[$statusCode, ['shortCode' => $shortCode]] = $this->createShortUrl([ [$statusCode, ['shortCode' => $shortCode]] = $this->createShortUrl([
'validSince' => Chronos::now()->addDay()->toAtomString(), 'validSince' => Chronos::now()->addDays(1)->toAtomString(),
]); ]);
self::assertEquals(self::STATUS_OK, $statusCode); self::assertEquals(self::STATUS_OK, $statusCode);
@ -129,7 +129,7 @@ class CreateShortUrlTest extends ApiTestCase
public function createsShortUrlWithValidUntil(): void public function createsShortUrlWithValidUntil(): void
{ {
[$statusCode, ['shortCode' => $shortCode]] = $this->createShortUrl([ [$statusCode, ['shortCode' => $shortCode]] = $this->createShortUrl([
'validUntil' => Chronos::now()->subDay()->toAtomString(), 'validUntil' => Chronos::now()->subDays(1)->toAtomString(),
]); ]);
self::assertEquals(self::STATUS_OK, $statusCode); self::assertEquals(self::STATUS_OK, $statusCode);

View File

@ -55,13 +55,13 @@ class EditShortUrlTest extends ApiTestCase
{ {
$now = Chronos::now(); $now = Chronos::now();
yield [['validSince' => $now->addMonth()->toAtomString()]]; yield [['validSince' => $now->addMonths(1)->toAtomString()]];
yield [['validUntil' => $now->subMonth()->toAtomString()]]; yield [['validUntil' => $now->subMonths(1)->toAtomString()]];
yield [['maxVisits' => 20]]; yield [['maxVisits' => 20]];
yield [['validUntil' => $now->addYear()->toAtomString(), 'maxVisits' => 100]]; yield [['validUntil' => $now->addYears(1)->toAtomString(), 'maxVisits' => 100]];
yield [[ yield [[
'validSince' => $now->subYear()->toAtomString(), 'validSince' => $now->subYears(1)->toAtomString(),
'validUntil' => $now->addYear()->toAtomString(), 'validUntil' => $now->addYears(1)->toAtomString(),
'maxVisits' => 100, 'maxVisits' => 100,
]]; ]];
} }

View File

@ -30,6 +30,6 @@ class NonOrphanVisitsTest extends ApiTestCase
yield 'last page' => [['page' => 3, 'itemsPerPage' => 3], 7, 1]; yield 'last page' => [['page' => 3, 'itemsPerPage' => 3], 7, 1];
yield 'bots excluded' => [['excludeBots' => 'true'], 6, 6]; yield 'bots excluded' => [['excludeBots' => 'true'], 6, 6];
yield 'bots excluded and pagination' => [['excludeBots' => 'true', 'page' => 1, 'itemsPerPage' => 4], 6, 4]; yield 'bots excluded and pagination' => [['excludeBots' => 'true', 'page' => 1, 'itemsPerPage' => 4], 6, 4];
yield 'date filter' => [['startDate' => Chronos::now()->addDay()->toAtomString()], 0, 0]; yield 'date filter' => [['startDate' => Chronos::now()->addDays(1)->toAtomString()], 0, 0];
} }
} }

View File

@ -37,8 +37,8 @@ class ResolveShortUrlTest extends ApiTestCase
{ {
$now = Chronos::now(); $now = Chronos::now();
yield 'future validSince' => [['validSince' => $now->addMonth()->toAtomString()]]; yield 'future validSince' => [['validSince' => $now->addMonths(1)->toAtomString()]];
yield 'past validUntil' => [['validUntil' => $now->subMonth()->toAtomString()]]; yield 'past validUntil' => [['validUntil' => $now->subMonths(1)->toAtomString()]];
yield 'maxVisits reached' => [['maxVisits' => 1]]; yield 'maxVisits reached' => [['maxVisits' => 1]];
} }

View File

@ -28,7 +28,7 @@ class ApiKeyFixture extends AbstractFixture implements DependentFixtureInterface
$manager->persist($this->buildApiKey( $manager->persist($this->buildApiKey(
'expired_api_key', 'expired_api_key',
enabled: true, enabled: true,
expiresAt: Chronos::now()->subDay()->startOfDay(), expiresAt: Chronos::now()->subDays(1)->startOfDay(),
)); ));
$authorApiKey = $this->buildApiKey('author_api_key', enabled: true); $authorApiKey = $this->buildApiKey('author_api_key', enabled: true);

View File

@ -81,7 +81,7 @@ class ApiKeyServiceTest extends TestCase
{ {
yield 'non-existent api key' => [null]; yield 'non-existent api key' => [null];
yield 'disabled api key' => [ApiKey::create()->disable()]; yield 'disabled api key' => [ApiKey::create()->disable()];
yield 'expired api key' => [ApiKey::fromMeta(ApiKeyMeta::withExpirationDate(Chronos::now()->subDay()))]; yield 'expired api key' => [ApiKey::fromMeta(ApiKeyMeta::withExpirationDate(Chronos::now()->subDays(1)))];
} }
#[Test] #[Test]