From 2dfc228917857f6cd6e64b473ba8bb63150ff826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 28 Aug 2023 16:06:30 +0200 Subject: [PATCH] Fix initial query for calendar export query --- .../Export/Aggregator/ScopeAggregator.php | 6 ++++-- .../Tests/Export/Aggregator/JobAggregatorTest.php | 2 +- .../Tests/Export/Aggregator/ScopeAggregatorTest.php | 2 +- .../Tests/Export/Filter/BetweenDatesFilterTest.php | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php index b6209fd3c..75ed90562 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php @@ -22,8 +22,10 @@ use function in_array; final readonly class ScopeAggregator implements AggregatorInterface { - public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) - { + public function __construct( + private ScopeRepository $scopeRepository, + private TranslatableStringHelper $translatableStringHelper + ) { } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php index dfbd7db16..cc697e472 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php @@ -62,7 +62,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest $em->createQueryBuilder() ->select('count(cal.id)') ->from(Calendar::class, 'cal') - ->join('cal.user', 'caluser'), + ->join('cal.mainUser', 'caluser'), ]; } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php index 773d42d21..ea1304381 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php @@ -62,7 +62,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest $em->createQueryBuilder() ->select('count(cal.id)') ->from(Calendar::class, 'cal') - ->join('cal.user', 'caluser'), + ->join('cal.mainUser', 'caluser'), ]; } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php index 85db16c72..e8cee9ef1 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php @@ -20,6 +20,7 @@ namespace Chill\CalendarBundle\Tests\Export\Filter; use Chill\CalendarBundle\Entity\Calendar; use Chill\CalendarBundle\Export\Filter\BetweenDatesFilter; +use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Test\Export\AbstractFilterTest; use DateTime; use Doctrine\ORM\EntityManagerInterface; @@ -54,8 +55,8 @@ final class BetweenDatesFilterTest extends AbstractFilterTest { return [ [ - 'date_from' => DateTime::createFromFormat('Y-m-d', '2022-05-01'), - 'date_to' => DateTime::createFromFormat('Y-m-d', '2022-06-01'), + 'date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), + 'date_to' => new RollingDate(RollingDate::T_TODAY), ], ]; }