diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php deleted file mode 100644 index 79c0924f7..000000000 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php +++ /dev/null @@ -1,82 +0,0 @@ -getContainer(); - - $this->aggregator = $container->get('chill.activity.export.reason_aggregator'); - - // add a fake request with a default locale (used in translatable string) - $prophet = new \Prophecy\Prophet(); - $request = $prophet->prophesize(); - $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); - $request->getLocale()->willReturn('fr'); - - $container->get('request_stack') - ->push($request->reveal()); - } - - public function getAggregator() - { - return $this->aggregator; - } - - public function getFormData() - { - return [ - ['level' => 'reasons'], - ['level' => 'categories'], - ]; - } - - public function getQueryBuilders() - { - if (null === self::$kernel) { - self::bootKernel(); - } - - $em = self::$kernel->getContainer() - ->get('doctrine.orm.entity_manager'); - - return [ - $em->createQueryBuilder() - ->select('count(activity.id)') - ->from('ChillActivityBundle:Activity', 'activity'), - $em->createQueryBuilder() - ->select('count(activity.id)') - ->from('ChillActivityBundle:Activity', 'activity') - ->join('activity.reasons', 'reasons'), - $em->createQueryBuilder() - ->select('count(activity.id)') - ->from('ChillActivityBundle:Activity', 'activity') - ->join('activity.reasons', 'reasons') - ->join('reasons.category', 'category'), - ]; - } -} diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/ActivityReasonAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/ActivityReasonAggregatorTest.php index 6de364ae7..f89c20e31 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/ActivityReasonAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/ActivityReasonAggregatorTest.php @@ -15,9 +15,12 @@ use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Doctrine\ORM\EntityManagerInterface; +use Prophecy\PhpUnit\ProphecyTrait; final class ActivityReasonAggregatorTest extends AbstractAggregatorTest { + use ProphecyTrait; + private ActivityReasonAggregator $aggregator; protected function setUp(): void @@ -25,6 +28,14 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest self::bootKernel(); $this->aggregator = self::$container->get('chill.activity.export.reason_aggregator'); + + $request = $this->prophesize() + ->willExtend(\Symfony\Component\HttpFoundation\Request::class); + + $request->getLocale()->willReturn('fr'); + + self::$container->get('request_stack') + ->push($request->reveal()); } public function getAggregator() @@ -35,12 +46,8 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest public function getFormData(): array { return [ - [ - 'level' => 'reasons', - ], - [ - 'level' => 'categories', - ] + ['level' => 'reasons'], + ['level' => 'categories'], ]; } @@ -55,11 +62,16 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest return [ $em->createQueryBuilder() ->select('count(activity.id)') - ->from(Activity::class, 'activity') - ->join('activity.person', 'actperson') - ->innerJoin('activity.reasons', 'actreasons') - ->join('actreasons.category', 'actreasoncat') - , + ->from('ChillActivityBundle:Activity', 'activity'), + $em->createQueryBuilder() + ->select('count(activity.id)') + ->from('ChillActivityBundle:Activity', 'activity') + ->join('activity.reasons', 'actreasons'), + $em->createQueryBuilder() + ->select('count(activity.id)') + ->from('ChillActivityBundle:Activity', 'activity') + ->join('activity.reasons', 'actreasons') + ->join('actreasons.category', 'actreasoncat'), ]; } }