fix some tests

This commit is contained in:
Julien Fastré 2022-10-15 00:35:13 +02:00
parent dd0e2a169c
commit 3e5be50a87
6 changed files with 14 additions and 14 deletions

View File

@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function in_array;
final class CountryOfBirthAggregator implements AggregatorInterface, ExportElementValidatedInterface
{
@ -83,7 +84,9 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme
. ' is not known.');
}
$qb->leftJoin('person.countryOfBirth', 'countryOfBirth');
if (!in_array('countryOfBirth', $qb->getAllAliases(), true)) {
$qb->leftJoin('person.countryOfBirth', 'countryOfBirth');
}
// add group by
$qb->addGroupBy('country_of_birth_aggregator');

View File

@ -63,13 +63,9 @@ final class GoalRepository implements ObjectRepository
}
/**
* @param mixed|null $orderBy
* @param mixed|null $limit
* @param mixed|null $offset
*
* @return Goal[]
*/
public function findBySocialActionWithDescendants(SocialAction $action, $orderBy = null, $limit = null, $offset = null): array
public function findBySocialActionWithDescendants(SocialAction $action, array $orderBy = [], ?int $limit = null, ?int $offset = null): array
{
$qb = $this->buildQueryBySocialActionWithDescendants($action);
$qb->select('g');

View File

@ -96,13 +96,9 @@ final class ResultRepository implements ObjectRepository
}
/**
* @param mixed|null $orderBy
* @param mixed|null $limit
* @param mixed|null $offset
*
* @return Result[]
*/
public function findBySocialActionWithDescendants(SocialAction $action, $orderBy = null, $limit = null, $offset = null): array
public function findBySocialActionWithDescendants(SocialAction $action, array $orderBy = [], ?int $limit = null, ?int $offset = null): array
{
$qb = $this->buildQueryBySocialActionWithDescendants($action);
$qb->select('r');

View File

@ -39,7 +39,9 @@ final class DurationAggregatorTest extends AbstractAggregatorTest
public function getFormData(): array
{
return [
[],
['precision' => 'day'],
['precision' => 'week'],
['precision' => 'month'],
];
}

View File

@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregato
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\GeographicalUnitStatAggregator;
use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
/**
@ -38,8 +39,9 @@ final class GeographicalUnitStatAggregatorTest extends AbstractAggregatorTest
public function getFormData(): array
{
// TODO: add geographical unit stat into fixtures and provide a level
return [
[],
['date_calc' => new DateTimeImmutable('today'), 'level' => null],
];
}

View File

@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregato
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ReferrerAggregator;
use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
/**
@ -39,7 +40,7 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
public function getFormData(): array
{
return [
[],
['date_calc' => new DateTimeImmutable('now')],
];
}