mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Remove test which seems to be not up to date with filter
This commit is contained in:
parent
355ed03500
commit
f8f04c69d0
@ -1,105 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\SocialWorkFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\SocialWorkFilters\SocialWorkTypeFilter;
|
||||
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
|
||||
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SocialWorkTypeFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private SocialWorkTypeFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_social_work_type');
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
$action_repository = self::$container->get(SocialActionRepository::class);
|
||||
$goal_repository = self::$container->get(GoalRepository::class);
|
||||
$result_repository = self::$container->get(ResultRepository::class);
|
||||
|
||||
$actions = [];
|
||||
$goals = [];
|
||||
$results = [];
|
||||
|
||||
$social_actions = $action_repository->findAll();
|
||||
|
||||
foreach ($social_actions as $action) {
|
||||
$actions[] = $action->getId();
|
||||
$goals_by_action = $goal_repository->findBySocialActionWithDescendants($action);
|
||||
|
||||
foreach ($goals_by_action as $goal) {
|
||||
$goals[] = $goal->getId();
|
||||
$results_by_goal = $result_repository->findByGoal($goal);
|
||||
|
||||
foreach ($results_by_goal as $result) {
|
||||
$results[] = $result->getId();
|
||||
}
|
||||
}
|
||||
$results_by_action = $result_repository->findBySocialActionWithDescendants($action);
|
||||
|
||||
foreach ($results_by_action as $result) {
|
||||
$results[] = $result->getId();
|
||||
}
|
||||
}
|
||||
|
||||
sort($actions);
|
||||
sort($goals);
|
||||
sort($results);
|
||||
|
||||
$actions = array_unique($actions);
|
||||
$goals = array_unique($goals);
|
||||
$results = array_unique($results);
|
||||
|
||||
return [
|
||||
[
|
||||
'actionType' => implode(',', $actions),
|
||||
'goal' => implode(',', $goals),
|
||||
'result' => implode(',', $results),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acpw.id')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw'),
|
||||
];
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user