mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Update dependencies
This commit is contained in:
@@ -70,7 +70,7 @@ class GeolocationDbUpdater implements GeolocationDbUpdaterInterface
|
||||
$buildTimestamp = $this->resolveBuildTimestamp($meta);
|
||||
$buildDate = Chronos::createFromTimestamp($buildTimestamp);
|
||||
|
||||
return Chronos::now()->gt($buildDate->addDays(35));
|
||||
return Chronos::now()->greaterThan($buildDate->addDays(35));
|
||||
}
|
||||
|
||||
private function resolveBuildTimestamp(Metadata $meta): int
|
||||
|
||||
@@ -24,7 +24,7 @@ class ListApiKeysTest extends CliTestCase
|
||||
|
||||
public static function provideFlags(): iterable
|
||||
{
|
||||
$expiredApiKeyDate = Chronos::now()->subDay()->startOfDay()->toAtomString();
|
||||
$expiredApiKeyDate = Chronos::now()->subDays(1)->startOfDay()->toAtomString();
|
||||
$enabledOnlyOutput = <<<OUT
|
||||
+--------------------+------+---------------------------+--------------------------+
|
||||
| Key | Name | Expiration date | Roles |
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace ShlinkioTest\Shlink\CLI\Util;
|
||||
|
||||
use PHPUnit\Framework\Assert;
|
||||
use PHPUnit\Framework\MockObject\Generator;
|
||||
use PHPUnit\Framework\MockObject\Generator\Generator;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
@@ -139,7 +139,7 @@ class ImportedLinksProcessor implements ImportedLinksProcessorInterface
|
||||
$importedVisits = 0;
|
||||
foreach ($iterable as $importedOrphanVisit) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ final class ShortUrlImporting
|
||||
$importedVisits = 0;
|
||||
foreach ($visits as $importedVisit) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -319,12 +319,12 @@ class ShortUrl extends AbstractEntity
|
||||
}
|
||||
|
||||
$now = Chronos::now();
|
||||
$beforeValidSince = $this->validSince !== null && $this->validSince->gt($now);
|
||||
$beforeValidSince = $this->validSince !== null && $this->validSince->greaterThan($now);
|
||||
if ($beforeValidSince) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$afterValidUntil = $this->validUntil !== null && $this->validUntil->lt($now);
|
||||
$afterValidUntil = $this->validUntil !== null && $this->validUntil->lessThan($now);
|
||||
if ($afterValidUntil) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -307,9 +307,9 @@ class ImportedLinksProcessorTest extends TestCase
|
||||
yield 'existing orphan visit' => [true, [
|
||||
new ImportedShlinkOrphanVisit('', '', Chronos::now()->subDays(3), '', '', null),
|
||||
new ImportedShlinkOrphanVisit('', '', Chronos::now()->subDays(2), '', '', null),
|
||||
new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDay(), '', '', null),
|
||||
new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDay(), '', '', null),
|
||||
new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDay(), '', '', null),
|
||||
new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDays(1), '', '', null),
|
||||
new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDays(1), '', '', null),
|
||||
new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDays(1), '', '', null),
|
||||
], Visit::forBasePath(Visitor::botInstance()), 3];
|
||||
}
|
||||
|
||||
|
||||
@@ -121,15 +121,15 @@ class ShortUrlResolverTest extends TestCase
|
||||
return $shortUrl;
|
||||
})()];
|
||||
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(
|
||||
['validUntil' => $now->subMonth()->toAtomString(), 'longUrl' => 'https://longUrl'],
|
||||
['validUntil' => $now->subMonths(1)->toAtomString(), 'longUrl' => 'https://longUrl'],
|
||||
))];
|
||||
yield 'mixed' => [(function () use ($now) {
|
||||
$shortUrl = ShortUrl::create(ShortUrlCreation::fromRawData([
|
||||
'maxVisits' => 3,
|
||||
'validUntil' => $now->subMonth()->toAtomString(),
|
||||
'validUntil' => $now->subMonths(1)->toAtomString(),
|
||||
'longUrl' => 'https://longUrl',
|
||||
]));
|
||||
$shortUrl->setVisits(new ArrayCollection(map(
|
||||
|
||||
@@ -65,7 +65,7 @@ class ApiKey extends AbstractEntity
|
||||
|
||||
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
|
||||
|
||||
@@ -115,7 +115,7 @@ class CreateShortUrlTest extends ApiTestCase
|
||||
public function createsShortUrlWithValidSince(): void
|
||||
{
|
||||
[$statusCode, ['shortCode' => $shortCode]] = $this->createShortUrl([
|
||||
'validSince' => Chronos::now()->addDay()->toAtomString(),
|
||||
'validSince' => Chronos::now()->addDays(1)->toAtomString(),
|
||||
]);
|
||||
|
||||
self::assertEquals(self::STATUS_OK, $statusCode);
|
||||
@@ -129,7 +129,7 @@ class CreateShortUrlTest extends ApiTestCase
|
||||
public function createsShortUrlWithValidUntil(): void
|
||||
{
|
||||
[$statusCode, ['shortCode' => $shortCode]] = $this->createShortUrl([
|
||||
'validUntil' => Chronos::now()->subDay()->toAtomString(),
|
||||
'validUntil' => Chronos::now()->subDays(1)->toAtomString(),
|
||||
]);
|
||||
|
||||
self::assertEquals(self::STATUS_OK, $statusCode);
|
||||
|
||||
@@ -55,13 +55,13 @@ class EditShortUrlTest extends ApiTestCase
|
||||
{
|
||||
$now = Chronos::now();
|
||||
|
||||
yield [['validSince' => $now->addMonth()->toAtomString()]];
|
||||
yield [['validUntil' => $now->subMonth()->toAtomString()]];
|
||||
yield [['validSince' => $now->addMonths(1)->toAtomString()]];
|
||||
yield [['validUntil' => $now->subMonths(1)->toAtomString()]];
|
||||
yield [['maxVisits' => 20]];
|
||||
yield [['validUntil' => $now->addYear()->toAtomString(), 'maxVisits' => 100]];
|
||||
yield [['validUntil' => $now->addYears(1)->toAtomString(), 'maxVisits' => 100]];
|
||||
yield [[
|
||||
'validSince' => $now->subYear()->toAtomString(),
|
||||
'validUntil' => $now->addYear()->toAtomString(),
|
||||
'validSince' => $now->subYears(1)->toAtomString(),
|
||||
'validUntil' => $now->addYears(1)->toAtomString(),
|
||||
'maxVisits' => 100,
|
||||
]];
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ class NonOrphanVisitsTest extends ApiTestCase
|
||||
yield 'last page' => [['page' => 3, 'itemsPerPage' => 3], 7, 1];
|
||||
yield 'bots excluded' => [['excludeBots' => 'true'], 6, 6];
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ class ResolveShortUrlTest extends ApiTestCase
|
||||
{
|
||||
$now = Chronos::now();
|
||||
|
||||
yield 'future validSince' => [['validSince' => $now->addMonth()->toAtomString()]];
|
||||
yield 'past validUntil' => [['validUntil' => $now->subMonth()->toAtomString()]];
|
||||
yield 'future validSince' => [['validSince' => $now->addMonths(1)->toAtomString()]];
|
||||
yield 'past validUntil' => [['validUntil' => $now->subMonths(1)->toAtomString()]];
|
||||
yield 'maxVisits reached' => [['maxVisits' => 1]];
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class ApiKeyFixture extends AbstractFixture implements DependentFixtureInterface
|
||||
$manager->persist($this->buildApiKey(
|
||||
'expired_api_key',
|
||||
enabled: true,
|
||||
expiresAt: Chronos::now()->subDay()->startOfDay(),
|
||||
expiresAt: Chronos::now()->subDays(1)->startOfDay(),
|
||||
));
|
||||
|
||||
$authorApiKey = $this->buildApiKey('author_api_key', enabled: true);
|
||||
|
||||
@@ -81,7 +81,7 @@ class ApiKeyServiceTest extends TestCase
|
||||
{
|
||||
yield 'non-existent api key' => [null];
|
||||
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]
|
||||
|
||||
Reference in New Issue
Block a user