Enhanced db tests for expired short urls filtering

This commit is contained in:
Alejandro Celaya 2022-12-11 12:33:17 +01:00
parent cdde59b543
commit d832133410
2 changed files with 4 additions and 5 deletions

View File

@ -82,11 +82,6 @@ class ShortUrlRepository extends EntitySpecificationRepository implements ShortU
$qb->select('COUNT(DISTINCT s)');
$query = $qb->getQuery();
// TODO Check if this is needed
// if ($filtering->excludeMaxVisitsReached) {
// $qb->addSelect('COUNT(DISTINCT v)');
// }
// TODO This is crap...
return $filtering->excludeMaxVisitsReached
? count($query->getSingleColumnResult())

View File

@ -378,9 +378,13 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
);
self::assertCount(4, $this->repo->findList($filtering(false, false)));
self::assertEquals(4, $this->repo->countList($filtering(false, false)));
self::assertCount(3, $this->repo->findList($filtering(true, false)));
self::assertEquals(3, $this->repo->countList($filtering(true, false)));
self::assertCount(3, $this->repo->findList($filtering(false, true)));
self::assertEquals(3, $this->repo->countList($filtering(false, true)));
self::assertCount(2, $this->repo->findList($filtering(true, true)));
self::assertEquals(2, $this->repo->countList($filtering(true, true)));
}
/** @test */