From 6405f2101f3992366335666ad54987693e88cbca Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 21 Sep 2022 12:45:31 +0200 Subject: [PATCH] exports: add new tests for calendar aggregators (untested) --- .../Export/Aggregator/AgentAggregatorTest.php | 58 +++++++++++++++++++ .../Aggregator/CancelReasonAggregatorTest.php | 58 +++++++++++++++++++ .../Export/Aggregator/JobAggregatorTest.php | 58 +++++++++++++++++++ .../Aggregator/LocationAggregatorTest.php | 58 +++++++++++++++++++ .../Aggregator/LocationTypeAggregatorTest.php | 58 +++++++++++++++++++ .../Aggregator/MonthYearAggregatorTest.php | 57 ++++++++++++++++++ .../Export/Aggregator/ScopeAggregatorTest.php | 58 +++++++++++++++++++ 7 files changed, 405 insertions(+) create mode 100644 src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php create mode 100644 src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php create mode 100644 src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php create mode 100644 src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php create mode 100644 src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php create mode 100644 src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php create mode 100644 src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php new file mode 100644 index 000000000..6e50eebc4 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.calendar.export.agent_aggregator'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData(): array + { + return [ + [], + ]; + } + + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(cal.id)') + ->from(Calendar::class, 'cal') + ->join('cal.mainUser', 'caluser') + , + ]; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php new file mode 100644 index 000000000..3d871d542 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.calendar.export.cancel_reason_aggregator'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData(): array + { + return [ + [], + ]; + } + + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(cal.id)') + ->from(Calendar::class, 'cal') + ->join('cal.cancelReason', 'calcancel') + , + ]; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php new file mode 100644 index 000000000..278bf2254 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.calendar.export.job_aggregator'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData(): array + { + return [ + [], + ]; + } + + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(cal.id)') + ->from(Calendar::class, 'cal') + ->join('cal.user', 'caluser') + , + ]; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php new file mode 100644 index 000000000..49d7530cf --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.calendar.export.location_aggregator'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData(): array + { + return [ + [], + ]; + } + + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(cal.id)') + ->from(Calendar::class, 'cal') + ->join('cal.location', 'calloc') + , + ]; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php new file mode 100644 index 000000000..c06d2f036 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.calendar.export.location_type_aggregator'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData(): array + { + return [ + [], + ]; + } + + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(cal.id)') + ->from(Calendar::class, 'cal') + ->join('cal.location', 'calloc') + , + ]; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php new file mode 100644 index 000000000..885344148 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php @@ -0,0 +1,57 @@ +aggregator = self::$container->get('chill.calendar.export.month_aggregator'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData(): array + { + return [ + [], + ]; + } + + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(cal.id)') + ->from(Calendar::class, 'cal') + , + ]; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php new file mode 100644 index 000000000..b95fd6f86 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.calendar.export.scope_aggregator'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData(): array + { + return [ + [], + ]; + } + + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(cal.id)') + ->from(Calendar::class, 'cal') + ->join('cal.user', 'caluser') + , + ]; + } +}