fix tests implementing AbstractAggregatorTest

This commit is contained in:
2023-09-01 15:07:37 +02:00
parent a197a6b418
commit 37c1dfb0ba
53 changed files with 215 additions and 212 deletions

View File

@@ -45,9 +45,7 @@ final class BySocialActionAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -55,8 +53,8 @@ final class BySocialActionAggregatorTest extends AbstractAggregatorTest
$em->createQueryBuilder()
->select('count(activity.id)')
->from(Activity::class, 'activity')
->join('activity.accompanyingPeriod', 'acp')
->join('activity.socialActions', 'actsocialaction'),
->leftJoin('activity.accompanyingPeriod', 'acp')
->leftJoin('activity.socialActions', 'actsocialaction'),
];
}
}

View File

@@ -45,18 +45,16 @@ final class BySocialIssueAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('count(activity.id)')
->select('count(activity)')
->from(Activity::class, 'activity')
->join('activity.accompanyingPeriod', 'acp')
->join('activity.socialIssues', 'actsocialissue'),
->leftJoin('activity.accompanyingPeriod', 'acp')
->leftJoin('activity.socialIssues', 'actsocialissue'),
];
}
}

View File

@@ -45,9 +45,7 @@ final class ByThirdpartyAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -55,8 +53,8 @@ final class ByThirdpartyAggregatorTest extends AbstractAggregatorTest
$em->createQueryBuilder()
->select('count(activity.id)')
->from(Activity::class, 'activity')
->join('activity.accompanyingPeriod', 'acp')
->join('activity.thirdParties', 'acttparty'),
->leftJoin('activity.accompanyingPeriod', 'acp')
->leftJoin('activity.thirdParties', 'acttparty'),
];
}
}

View File

@@ -28,7 +28,7 @@ final class ByUserAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.activity.export.byuser_aggregator');
$this->aggregator = self::$container->get(ByCreatorAggregator::class);
}
public function getAggregator()
@@ -45,9 +45,7 @@ final class ByUserAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -55,8 +53,8 @@ final class ByUserAggregatorTest extends AbstractAggregatorTest
$em->createQueryBuilder()
->select('count(activity.id)')
->from(Activity::class, 'activity')
->join('activity.accompanyingPeriod', 'acp')
->join('activity.users', 'actusers'),
->leftJoin('activity.accompanyingPeriod', 'acp')
->leftJoin('activity.users', 'actusers'),
];
}
}

View File

@@ -53,9 +53,7 @@ final class DateAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -63,7 +61,7 @@ final class DateAggregatorTest extends AbstractAggregatorTest
$em->createQueryBuilder()
->select('count(activity.id)')
->from(Activity::class, 'activity')
->join('activity.accompanyingPeriod', 'acp'),
->leftJoin('activity.accompanyingPeriod', 'acp'),
];
}
}

View File

@@ -45,9 +45,7 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -55,8 +53,8 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest
$em->createQueryBuilder()
->select('count(activity.id)')
->from(Activity::class, 'activity')
->join('activity.accompanyingPeriod', 'acp')
->join('activity.location', 'actloc'),
->leftJoin('activity.accompanyingPeriod', 'acp')
->leftJoin('activity.location', 'actloc'),
];
}
}

View File

@@ -28,7 +28,7 @@ final class UserScopeAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.activity.export.userscope_aggregator');
$this->aggregator = self::$container->get(CreatorScopeAggregator::class);
}
public function getAggregator()
@@ -45,9 +45,7 @@ final class UserScopeAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -55,8 +53,8 @@ final class UserScopeAggregatorTest extends AbstractAggregatorTest
$em->createQueryBuilder()
->select('count(activity.id)')
->from(Activity::class, 'activity')
->join('activity.accompanyingPeriod', 'acp')
->join('activity.user', 'actuser'),
->leftJoin('activity.accompanyingPeriod', 'acp')
->leftJoin('activity.user', 'actuser'),
];
}
}

View File

@@ -11,6 +11,8 @@ declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Aggregator;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Entity\ActivityType;
use Chill\ActivityBundle\Export\Aggregator\ActivityTypeAggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Doctrine\ORM\EntityManagerInterface;
@@ -32,7 +34,7 @@ final class ActivityTypeAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.activity.export.type_aggregator');
$this->aggregator = self::$container->get(ActivityTypeAggregator::class);
$request = $this->prophesize()
->willExtend(\Symfony\Component\HttpFoundation\Request::class);
@@ -57,19 +59,17 @@ final class ActivityTypeAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders()
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('count(activity.id)')
->from('ChillActivityBundle:Activity', 'activity'),
->from(Activity::class, 'activity'),
$em->createQueryBuilder()
->select('count(activity.id)')
->from('ChillActivityBundle:Activity', 'activity')
->from(Activity::class, 'activity')
->join('activity.activityType', 'acttype'),
];
}

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Aggregator;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Doctrine\ORM\EntityManagerInterface;
@@ -57,16 +58,14 @@ final class ActivityUserAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('count(activity.id)')
->from('ChillActivityBundle:Activity', 'activity'),
->from(Activity::class, 'activity'),
];
}
}

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Aggregator\PersonAggregators;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Doctrine\ORM\EntityManagerInterface;
@@ -30,7 +31,7 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.activity.export.reason_aggregator');
$this->aggregator = self::$container->get(ActivityReasonAggregator::class);
$request = $this->prophesize()
->willExtend(\Symfony\Component\HttpFoundation\Request::class);
@@ -56,23 +57,21 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('count(activity.id)')
->from('ChillActivityBundle:Activity', 'activity'),
->from(Activity::class, 'activity'),
$em->createQueryBuilder()
->select('count(activity.id)')
->from('ChillActivityBundle:Activity', 'activity')
->from(Activity::class, 'activity')
->join('activity.reasons', 'actreasons'),
$em->createQueryBuilder()
->select('count(activity.id)')
->from('ChillActivityBundle:Activity', 'activity')
->from(Activity::class, 'activity')
->join('activity.reasons', 'actreasons')
->join('actreasons.category', 'actreasoncat'),
];