From 82e7094f3a5ad1910c9d4528a3e986446ed6bee4 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Apr 2024 20:48:03 +0200 Subject: [PATCH] Fix VisitIterationRepositoryTest for MS SQL --- .../src/Visit/Repository/VisitIterationRepository.php | 8 ++++---- .../Visit/Repository/VisitIterationRepositoryTest.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/module/Core/src/Visit/Repository/VisitIterationRepository.php b/module/Core/src/Visit/Repository/VisitIterationRepository.php index 0431788c..cf342611 100644 --- a/module/Core/src/Visit/Repository/VisitIterationRepository.php +++ b/module/Core/src/Visit/Repository/VisitIterationRepository.php @@ -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); diff --git a/module/Core/test-db/Visit/Repository/VisitIterationRepositoryTest.php b/module/Core/test-db/Visit/Repository/VisitIterationRepositoryTest.php index 7a683e3c..6d3d4b39 100644 --- a/module/Core/test-db/Visit/Repository/VisitIterationRepositoryTest.php +++ b/module/Core/test-db/Visit/Repository/VisitIterationRepositoryTest.php @@ -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, );