Fix VisitIterationRepositoryTest for MS SQL

This commit is contained in:
Alejandro Celaya 2024-04-13 20:48:03 +02:00
parent f0e62004d5
commit 82e7094f3a
2 changed files with 8 additions and 8 deletions

View File

@ -51,12 +51,12 @@ class VisitIterationRepository extends EntitySpecificationRepository implements
{
$qb = $this->createQueryBuilder('v');
if ($dateRange?->startDate !== null) {
$qb->andWhere($qb->expr()->gte('v.date', ':since'));
$qb->setParameter('since', $dateRange->startDate, ChronosDateTimeType::CHRONOS_DATETIME);
$qb->andWhere($qb->expr()->gte('v.date', ':since'))
->setParameter('since', $dateRange->startDate, ChronosDateTimeType::CHRONOS_DATETIME);
}
if ($dateRange?->endDate !== null) {
$qb->andWhere($qb->expr()->lte('v.date', ':until'));
$qb->setParameter('until', $dateRange->endDate, ChronosDateTimeType::CHRONOS_DATETIME);
$qb->andWhere($qb->expr()->lte('v.date', ':until'))
->setParameter('until', $dateRange->endDate, ChronosDateTimeType::CHRONOS_DATETIME);
}
return $this->visitsIterableForQuery($qb, $blockSize);

View File

@ -55,17 +55,17 @@ class VisitIterationRepositoryTest extends DatabaseTestCase
$unlocated = $this->repo->findUnlocatedVisits($blockSize);
$all = $this->repo->findAllVisits(blockSize: $blockSize);
$lastThreeDays = $this->repo->findAllVisits(
dateRange: DateRange::since(Chronos::now()->subDays(2)),
dateRange: DateRange::since(Chronos::now()->subDays(2)->startOfDay()),
blockSize: $blockSize,
);
$firstTwoDays = $this->repo->findAllVisits(
dateRange: DateRange::until(Chronos::now()->subDays(4)),
dateRange: DateRange::until(Chronos::now()->subDays(4)->endOfDay()),
blockSize: $blockSize,
);
$daysInBetween = $this->repo->findAllVisits(
dateRange: DateRange::between(
startDate: Chronos::now()->subDays(5),
endDate: Chronos::now()->subDays(2),
startDate: Chronos::now()->subDays(5)->startOfDay(),
endDate: Chronos::now()->subDays(2)->endOfDay(),
),
blockSize: $blockSize,
);