mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 14:25:00 +00:00
Fix filtres and scopes to take into account job and scope when the refferrer is add to the accompanying period work
This commit is contained in:
@@ -40,9 +40,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'job_at' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2020-01-01')),
|
||||
],
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -57,7 +55,6 @@ final class JobAggregatorTest extends AbstractAggregatorTest
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.referrers', 'acpwuser'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -40,9 +40,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'scope_at' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2020-01-01')),
|
||||
],
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -57,7 +55,6 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.referrers', 'acpwuser'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,53 @@
|
||||
<?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\Export;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Export\Formatter\SpreadsheetListFormatter;
|
||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriod;
|
||||
use Doctrine\ORM\AbstractQuery;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class ListAccompanyingPeriodTest extends KernelTestCase
|
||||
{
|
||||
private ListAccompanyingPeriod $listAccompanyingPeriod;
|
||||
|
||||
private CenterRepositoryInterface $centerRepository;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
self::bootKernel();
|
||||
|
||||
$this->listAccompanyingPeriod = self::$container->get(ListAccompanyingPeriod::class);
|
||||
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
|
||||
}
|
||||
|
||||
public function testQuery(): void
|
||||
{
|
||||
$centers = $this->centerRepository->findAll();
|
||||
|
||||
$query = $this->listAccompanyingPeriod->initiateQuery([], array_map(fn (Center $c) => ['center' => $c ], $centers), $exportOpts = ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
|
||||
|
||||
$query->setMaxResults(1);
|
||||
|
||||
$actual = $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
|
||||
|
||||
self::assertIsArray($actual);
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
<?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\Export;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWork;
|
||||
use Doctrine\ORM\AbstractQuery;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class ListAccompanyingPeriodWorkTest extends KernelTestCase
|
||||
{
|
||||
private ListAccompanyingPeriodWork $listAccompanyingPeriodWork;
|
||||
|
||||
private CenterRepositoryInterface $centerRepository;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
self::bootKernel();
|
||||
|
||||
$this->listAccompanyingPeriodWork = self::$container->get(ListAccompanyingPeriodWork::class);
|
||||
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
|
||||
}
|
||||
|
||||
public function testQuery(): void
|
||||
{
|
||||
$centers = $this->centerRepository->findAll();
|
||||
|
||||
$query = $this->listAccompanyingPeriodWork->initiateQuery([], array_map(fn (Center $c) => ['center' => $c], $centers), ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
|
||||
$query->setMaxResults(1);
|
||||
|
||||
self::assertIsArray($query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY));
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
<?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\Export;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\PersonBundle\Export\Export\ListEvaluation;
|
||||
use Doctrine\ORM\AbstractQuery;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class ListEvaluationTest extends KernelTestCase
|
||||
{
|
||||
private ListEvaluation $listEvaluation;
|
||||
|
||||
private CenterRepositoryInterface $centerRepository;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
self::bootKernel();
|
||||
|
||||
$this->listEvaluation = self::$container->get(ListEvaluation::class);
|
||||
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
|
||||
}
|
||||
|
||||
public function testQuery(): void
|
||||
{
|
||||
$centers = $this->centerRepository->findAll();
|
||||
|
||||
$query = $this->listEvaluation->initiateQuery([], array_map(fn (Center $c) => ['center' => $c], $centers), ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
|
||||
$query->setMaxResults(1);
|
||||
|
||||
self::assertIsArray($query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY));
|
||||
}
|
||||
}
|
@@ -51,7 +51,6 @@ final class JobFilterTest extends AbstractFilterTest
|
||||
return [
|
||||
[
|
||||
'job' => new ArrayCollection($jobs),
|
||||
'job_at' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2020-01-01'))
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@@ -50,7 +50,6 @@ final class ScopeFilterTest extends AbstractFilterTest
|
||||
return [
|
||||
[
|
||||
'scope' => $scopes,
|
||||
'scope_at' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2020-01-01'))
|
||||
]
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user