Documented tagsMode param for short URLs list

This commit is contained in:
Alejandro Celaya
2022-01-04 12:22:36 +01:00
parent 103af2e2c1
commit 665a3dbcbf
4 changed files with 24 additions and 23 deletions

View File

@@ -14,7 +14,6 @@ use Shlinkio\Shlink\Core\Entity\Visit;
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
use Shlinkio\Shlink\Core\Model\ShortUrlsOrdering;
use Shlinkio\Shlink\Core\Model\ShortUrlsParams;
use Shlinkio\Shlink\Core\Model\Visitor;
use Shlinkio\Shlink\Core\Repository\ShortUrlRepository;
use Shlinkio\Shlink\Core\ShortUrl\Resolver\PersistenceShortUrlRelationResolver;
@@ -128,29 +127,28 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
self::assertCount(1, $this->repo->findList(2, 2));
$tagsModeAll = ShortUrlsParams::TAGS_MODE_ANY;
$result = $this->repo->findList(null, null, null, [], $tagsModeAll, ShortUrlsOrdering::fromRawData([
$result = $this->repo->findList(null, null, null, [], null, ShortUrlsOrdering::fromRawData([
'orderBy' => 'visits-DESC',
]));
self::assertCount(3, $result);
self::assertSame($bar, $result[0]);
$result = $this->repo->findList(null, null, null, [], $tagsModeAll, null, DateRange::withEndDate(
$result = $this->repo->findList(null, null, null, [], null, null, DateRange::withEndDate(
Chronos::now()->subDays(2),
));
self::assertCount(1, $result);
self::assertEquals(1, $this->repo->countList(null, [], $tagsModeAll, DateRange::withEndDate(
self::assertEquals(1, $this->repo->countList(null, [], null, DateRange::withEndDate(
Chronos::now()->subDays(2),
)));
self::assertSame($foo2, $result[0]);
self::assertCount(
2,
$this->repo->findList(null, null, null, [], $tagsModeAll, null, DateRange::withStartDate(
$this->repo->findList(null, null, null, [], null, null, DateRange::withStartDate(
Chronos::now()->subDays(2),
)),
);
self::assertEquals(2, $this->repo->countList(null, [], $tagsModeAll, DateRange::withStartDate(
self::assertEquals(2, $this->repo->countList(null, [], null, DateRange::withStartDate(
Chronos::now()->subDays(2),
)));
}
@@ -165,14 +163,9 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
$this->getEntityManager()->flush();
$result = $this->repo->findList(
null,
null,
null,
[],
ShortUrlsParams::TAGS_MODE_ANY,
ShortUrlsOrdering::fromRawData(['orderBy' => 'longUrl-ASC']),
);
$result = $this->repo->findList(null, null, null, [], null, ShortUrlsOrdering::fromRawData([
'orderBy' => 'longUrl-ASC',
]));
self::assertCount(count($urls), $result);
self::assertEquals('a', $result[0]->getLongUrl());