mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Merge branch '111_exports' into social_action_exports
This commit is contained in:
commit
d59a22597d
@ -166,6 +166,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
$this->assertContainsOnly(
|
$this->assertContainsOnly(
|
||||||
'string',
|
'string',
|
||||||
$queryKeys,
|
$queryKeys,
|
||||||
|
true,
|
||||||
'test that the query keys returned by `getQueryKeys` are only strings'
|
'test that the query keys returned by `getQueryKeys` are only strings'
|
||||||
);
|
);
|
||||||
$this->assertGreaterThanOrEqual(
|
$this->assertGreaterThanOrEqual(
|
||||||
|
@ -16,6 +16,7 @@ use Doctrine\ORM\NativeQuery;
|
|||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Symfony\Component\BrowserKit\HttpBrowser;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Traversable;
|
use Traversable;
|
||||||
@ -140,6 +141,7 @@ abstract class AbstractExportTest extends WebTestCase
|
|||||||
$this->assertContainsOnly(
|
$this->assertContainsOnly(
|
||||||
'string',
|
'string',
|
||||||
$formattersTypes,
|
$formattersTypes,
|
||||||
|
true,
|
||||||
'Test that the method `getAllowedFormattersTypes` returns an array of string'
|
'Test that the method `getAllowedFormattersTypes` returns an array of string'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -174,6 +176,7 @@ abstract class AbstractExportTest extends WebTestCase
|
|||||||
$this->assertContainsOnly(
|
$this->assertContainsOnly(
|
||||||
'string',
|
'string',
|
||||||
$queryKeys,
|
$queryKeys,
|
||||||
|
true,
|
||||||
'test that the query keys returned by `getQueryKeys` are only strings'
|
'test that the query keys returned by `getQueryKeys` are only strings'
|
||||||
);
|
);
|
||||||
$this->assertGreaterThanOrEqual(
|
$this->assertGreaterThanOrEqual(
|
||||||
@ -330,8 +333,9 @@ abstract class AbstractExportTest extends WebTestCase
|
|||||||
*/
|
*/
|
||||||
public function testListExportPage()
|
public function testListExportPage()
|
||||||
{
|
{
|
||||||
/** @var \Symfony\Component\BrowserKit\Client $client */
|
/** @var HttpBrowser $client */
|
||||||
$client = $this->getClient();
|
$client = new HttpBrowser();
|
||||||
|
|
||||||
$export = $this->getExport();
|
$export = $this->getExport();
|
||||||
$prophet = new \Prophecy\Prophet();
|
$prophet = new \Prophecy\Prophet();
|
||||||
$container = static::$kernel->getContainer();
|
$container = static::$kernel->getContainer();
|
||||||
@ -395,6 +399,7 @@ abstract class AbstractExportTest extends WebTestCase
|
|||||||
$this->assertContainsOnly(
|
$this->assertContainsOnly(
|
||||||
'string',
|
'string',
|
||||||
$export->supportsModifiers(),
|
$export->supportsModifiers(),
|
||||||
|
true,
|
||||||
'Test that the `supportsModifiers` method returns only strings'
|
'Test that the `supportsModifiers` method returns only strings'
|
||||||
);
|
);
|
||||||
} elseif ($query instanceof NativeQuery) {
|
} elseif ($query instanceof NativeQuery) {
|
||||||
|
@ -13,6 +13,7 @@ namespace Chill\MainBundle\Test\Export;
|
|||||||
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
use function count;
|
use function count;
|
||||||
@ -27,14 +28,16 @@ use function is_string;
|
|||||||
*/
|
*/
|
||||||
abstract class AbstractFilterTest extends KernelTestCase
|
abstract class AbstractFilterTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
use ProphecyTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Prophecy\Prophet
|
* @var \Prophecy\Prophet
|
||||||
*/
|
*/
|
||||||
protected $prophet;
|
private $prophet;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->prepareProphet();
|
$$this->prophet = $this->getProphet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataProviderAlterQuery()
|
public function dataProviderAlterQuery()
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Export\Export;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Chill\PersonBundle\Export\Export\CountAccompanyingCourse;
|
||||||
|
|
||||||
|
final class CountAccompanyingCourseTest extends AbstractExportTest
|
||||||
|
{
|
||||||
|
private CountAccompanyingCourse $export;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->export = self::$container->get('chill.person.export.count_accompanyingcourse');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getExport()
|
||||||
|
{
|
||||||
|
return $this->export;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
return [[]];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getModifiersCombination()
|
||||||
|
{
|
||||||
|
return [[Declarations::ACP_TYPE]];
|
||||||
|
}
|
||||||
|
}
|
@ -30,7 +30,7 @@ final class CountPersonTest extends AbstractExportTest
|
|||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
$this->export = self::$container->get('chill.person.export.export_count_person');
|
$this->export = self::$container->get('chill.person.export.count_person');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Export\Export;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration;
|
||||||
|
|
||||||
|
final class StatAccompanyingCourseDurationTest extends AbstractExportTest
|
||||||
|
{
|
||||||
|
private StatAccompanyingCourseDuration $export;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->export = self::$container->get('chill.person.export.avg_accompanyingcourse_duration');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getExport()
|
||||||
|
{
|
||||||
|
return $this->export;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['closingdate' => \DateTime::createFromFormat('Y-m-d', '2022-06-30')],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModifiersCombination()
|
||||||
|
{
|
||||||
|
return [[Declarations::ACP_TYPE]];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||||
|
use Chill\PersonBundle\Export\Filter\ClosingMotiveFilter;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
class ClosingMotiveFilterTest extends AbstractFilterTest
|
||||||
|
{
|
||||||
|
private ClosingMotiveFilter $filter;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
// add a fake request with a default locale (used in translatable string)
|
||||||
|
$request = $this->prophesize();
|
||||||
|
|
||||||
|
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
|
$request->getLocale()->willReturn('fr');
|
||||||
|
|
||||||
|
$this->filter = self::$container->get('chill.person.export.filter_closingmotive');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
return $this->filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
$array = $em->createQueryBuilder()
|
||||||
|
->from(ClosingMotive::class, 'm')
|
||||||
|
->select('m')
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
foreach($array as $m) {
|
||||||
|
$data[] = ['accepted_closingmotives' => $m];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getQueryBuilders(): array
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null === self::$kernel) {
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
return [
|
||||||
|
$em->createQueryBuilder()
|
||||||
|
->select('acp.id')
|
||||||
|
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use Chill\PersonBundle\Export\Filter\ConfidentialFilter;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
class ConfidentialFilterTest extends AbstractFilterTest
|
||||||
|
{
|
||||||
|
private ConfidentialFilter $filter;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
// add a fake request with a default locale (used in translatable string)
|
||||||
|
$request = $this->prophesize();
|
||||||
|
|
||||||
|
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
|
$request->getLocale()->willReturn('fr');
|
||||||
|
|
||||||
|
$this->filter = self::$container->get('chill.person.export.filter_confidential');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
return $this->filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['accepted_confidentials' => true],
|
||||||
|
['accepted_confidentials' => false]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getQueryBuilders(): array
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null === self::$kernel) {
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
return [
|
||||||
|
$em->createQueryBuilder()
|
||||||
|
->select('acp.id')
|
||||||
|
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use Chill\PersonBundle\Export\Filter\EmergencyFilter;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
class EmergencyFilterTest extends AbstractFilterTest
|
||||||
|
{
|
||||||
|
private EmergencyFilter $filter;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
// add a fake request with a default locale (used in translatable string)
|
||||||
|
$request = $this->prophesize();
|
||||||
|
|
||||||
|
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
|
$request->getLocale()->willReturn('fr');
|
||||||
|
|
||||||
|
$this->filter = self::$container->get('chill.person.export.filter_emergency');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
return $this->filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['accepted_emergencies' => true],
|
||||||
|
['accepted_emergencies' => false]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQueryBuilders(): array
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null === self::$kernel) {
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
return [
|
||||||
|
$em->createQueryBuilder()
|
||||||
|
->select('acp.id')
|
||||||
|
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use Chill\PersonBundle\Export\Filter\IntensityFilter;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
class IntensityFilterTest extends AbstractFilterTest
|
||||||
|
{
|
||||||
|
private IntensityFilter $filter;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
// add a fake request with a default locale (used in translatable string)
|
||||||
|
$request = $this->prophesize();
|
||||||
|
|
||||||
|
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
|
$request->getLocale()->willReturn('fr');
|
||||||
|
|
||||||
|
$this->filter = self::$container->get('chill.person.export.filter_intensity');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
return $this->filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['accepted_intensities' => 'occasional'],
|
||||||
|
['accepted_intensities' => 'regular']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getQueryBuilders(): array
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null === self::$kernel) {
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
return [
|
||||||
|
$em->createQueryBuilder()
|
||||||
|
->select('acp.id')
|
||||||
|
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
|
||||||
|
use Chill\PersonBundle\Export\Filter\OriginFilter;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
class OriginFilterTest extends AbstractFilterTest
|
||||||
|
{
|
||||||
|
private OriginFilter $filter;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
// add a fake request with a default locale (used in translatable string)
|
||||||
|
$request = $this->prophesize();
|
||||||
|
|
||||||
|
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
|
$request->getLocale()->willReturn('fr');
|
||||||
|
|
||||||
|
$this->filter = self::$container->get('chill.person.export.filter_origin');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
return $this->filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
$array = $em->createQueryBuilder()
|
||||||
|
->from(Origin::class, 'o')
|
||||||
|
->select('o')
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
foreach($array as $l) {
|
||||||
|
$data[] = ['accepted_origins' => $l];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getQueryBuilders(): array
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null === self::$kernel) {
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
return [
|
||||||
|
$em->createQueryBuilder()
|
||||||
|
->select('acp.id')
|
||||||
|
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -1,63 +1,75 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\PersonBundle\Tests\Export\Filter;
|
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||||
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
use Chill\PersonBundle\Export\Filter\SocialIssueFilter;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
final class SocialIssueFilterTest extends AbstractFilterTest
|
class SocialIssueFilterTest extends AbstractFilterTest
|
||||||
{
|
{
|
||||||
/**
|
private SocialIssueFilter $filter;
|
||||||
* @var \Chill\PersonBundle\Export\Filter\GenderFilter
|
|
||||||
*/
|
|
||||||
private $filter;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
try {
|
// add a fake request with a default locale (used in translatable string)
|
||||||
$this->filter = self::$container->get('chill.person.export.filter_socialissue');
|
$request = $this->prophesize();
|
||||||
} catch (ServiceNotFoundException $e) {
|
|
||||||
$this->markTestSkipped('Filter service is not found');
|
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
}
|
$request->getLocale()->willReturn('fr');
|
||||||
|
|
||||||
|
$this->filter = self::$container->get('chill.person.export.filter_socialissue');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
public function getFilter()
|
public function getFilter()
|
||||||
{
|
{
|
||||||
return $this->filter;
|
return $this->filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData()
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFormData(): array
|
||||||
{
|
{
|
||||||
return [
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
['accepted_socialissue' => [
|
|
||||||
|
|
||||||
]],
|
$array = $em->createQueryBuilder()
|
||||||
['accepted_socialissue' => [
|
->from(SocialIssue::class, 'si')
|
||||||
|
->select('si')
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
|
||||||
]],
|
$data = [];
|
||||||
['accepted_socialissue' => [
|
|
||||||
|
|
||||||
]],
|
foreach($array as $i) {
|
||||||
];
|
$data[] = ['accepted_socialissues' => $i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryBuilders()
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getQueryBuilders(): array
|
||||||
{
|
{
|
||||||
// TODO: Implement getQueryBuilders() method.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (null === self::$kernel) {
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
return [
|
||||||
|
$em->createQueryBuilder()
|
||||||
|
->select('acp.id')
|
||||||
|
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Export\Filter\StepFilter;
|
||||||
|
|
||||||
|
class StepFilterTest extends AbstractFilterTest
|
||||||
|
{
|
||||||
|
private StepFilter $filter;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
// add a fake request with a default locale (used in translatable string)
|
||||||
|
$request = $this->prophesize();
|
||||||
|
|
||||||
|
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
|
$request->getLocale()->willReturn('fr');
|
||||||
|
|
||||||
|
$this->filter = self::$container->get('chill.person.export.filter_step');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
return $this->filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['accepted_steps' => AccompanyingPeriod::STEP_DRAFT],
|
||||||
|
['accepted_steps' => AccompanyingPeriod::STEP_CONFIRMED],
|
||||||
|
['accepted_steps' => AccompanyingPeriod::STEP_CLOSED],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getQueryBuilders(): array
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null === self::$kernel) {
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em = self::$container->get('doctrine.orm.entity_manager');
|
||||||
|
|
||||||
|
return [
|
||||||
|
$em->createQueryBuilder()
|
||||||
|
->select('acp.id')
|
||||||
|
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use Chill\PersonBundle\Export\Filter\UserJobFilter;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
class UserJobFilterTest extends AbstractFilterTest
|
||||||
|
{
|
||||||
|
private UserJobFilter $filter;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
// add a fake request with a default locale (used in translatable string)
|
||||||
|
$request = $this->prophesize();
|
||||||
|
|
||||||
|
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
|
$request->getLocale()->willReturn('fr');
|
||||||
|
|
||||||
|
$this->filter = self::$container->get('chill.person.export.filter_userjob');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
return $this->filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getQueryBuilders(): array
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null === self::$kernel) {
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
return [
|
||||||
|
$em->createQueryBuilder()
|
||||||
|
->select('acp.id')
|
||||||
|
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use Chill\PersonBundle\Export\Filter\UserScopeFilter;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
class UserScopeFilterTest extends AbstractFilterTest
|
||||||
|
{
|
||||||
|
private UserScopeFilter $filter;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
// add a fake request with a default locale (used in translatable string)
|
||||||
|
$request = $this->prophesize();
|
||||||
|
|
||||||
|
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
|
$request->getLocale()->willReturn('fr');
|
||||||
|
|
||||||
|
$this->filter = self::$container->get('chill.person.export.filter_userscope');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
return $this->filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getFormData(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getQueryBuilders(): array
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null === self::$kernel) {
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
|
return [
|
||||||
|
$em->createQueryBuilder()
|
||||||
|
->select('acp.id')
|
||||||
|
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user