mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-03 15:36:14 +00:00
merge master and fix cs
This commit is contained in:
parent
63b179bd4c
commit
2a65398277
@ -177,7 +177,7 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if shared with at least one user or one group
|
* Return true if shared with at least one user or one group.
|
||||||
*/
|
*/
|
||||||
public function isShared(): bool
|
public function isShared(): bool
|
||||||
{
|
{
|
||||||
|
@ -144,8 +144,6 @@ class ExportManager
|
|||||||
/**
|
/**
|
||||||
* @param string $alias
|
* @param string $alias
|
||||||
*
|
*
|
||||||
* @return AggregatorInterface
|
|
||||||
*
|
|
||||||
* @throws \RuntimeException if the aggregator is not known
|
* @throws \RuntimeException if the aggregator is not known
|
||||||
*/
|
*/
|
||||||
public function getAggregator($alias): AggregatorInterface
|
public function getAggregator($alias): AggregatorInterface
|
||||||
|
@ -41,8 +41,6 @@ class SpreadsheetListFormatter implements FormatterInterface, ExportManagerAware
|
|||||||
* of this formatter.
|
* of this formatter.
|
||||||
*
|
*
|
||||||
* @uses appendAggregatorForm
|
* @uses appendAggregatorForm
|
||||||
*
|
|
||||||
* @param string $exportAlias
|
|
||||||
*/
|
*/
|
||||||
public function buildForm(
|
public function buildForm(
|
||||||
FormBuilderInterface $builder,
|
FormBuilderInterface $builder,
|
||||||
@ -88,7 +86,7 @@ class SpreadsheetListFormatter implements FormatterInterface, ExportManagerAware
|
|||||||
return ['numerotation' => true, 'format' => 'xlsx'];
|
return ['numerotation' => true, 'format' => 'xlsx'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
public function getName(): string|TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Spreadsheet list formatter (.xlsx, .ods)';
|
return 'Spreadsheet list formatter (.xlsx, .ods)';
|
||||||
}
|
}
|
||||||
@ -214,8 +212,7 @@ class SpreadsheetListFormatter implements FormatterInterface, ExportManagerAware
|
|||||||
/**
|
/**
|
||||||
* Give the label corresponding to the given key and value.
|
* Give the label corresponding to the given key and value.
|
||||||
*
|
*
|
||||||
*
|
* @return string|\DateTimeInterface|int|float|TranslatableInterface|null
|
||||||
* @return string|\DateTimeInterface|int|null|float|TranslatableInterface
|
|
||||||
*
|
*
|
||||||
* @throws \LogicException if the label is not found
|
* @throws \LogicException if the label is not found
|
||||||
*/
|
*/
|
||||||
@ -231,10 +228,6 @@ class SpreadsheetListFormatter implements FormatterInterface, ExportManagerAware
|
|||||||
/**
|
/**
|
||||||
* Prepare the label cache which will be used by getLabel.
|
* Prepare the label cache which will be used by getLabel.
|
||||||
*
|
*
|
||||||
* @param array $result
|
|
||||||
* @param string $exportAlias
|
|
||||||
* @param array $exportData
|
|
||||||
*
|
|
||||||
* @return array The labels cache
|
* @return array The labels cache
|
||||||
*/
|
*/
|
||||||
private function prepareCacheLabels(array $result, string $exportAlias, array $exportData): array
|
private function prepareCacheLabels(array $result, string $exportAlias, array $exportData): array
|
||||||
@ -261,12 +254,6 @@ class SpreadsheetListFormatter implements FormatterInterface, ExportManagerAware
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* add the headers to the csv file.
|
* add the headers to the csv file.
|
||||||
*
|
|
||||||
* @param Worksheet $worksheet
|
|
||||||
* @param array $result
|
|
||||||
* @param array $formatterData
|
|
||||||
* @param string $exportAlias
|
|
||||||
* @param array $exportData
|
|
||||||
*/
|
*/
|
||||||
protected function prepareHeaders(array $labelsCache, Worksheet $worksheet, array $result, array $formatterData, string $exportAlias, array $exportData)
|
protected function prepareHeaders(array $labelsCache, Worksheet $worksheet, array $result, array $formatterData, string $exportAlias, array $exportData)
|
||||||
{
|
{
|
||||||
|
@ -34,119 +34,6 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
self::ensureKernelShutdown();
|
self::ensureKernelShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* provide data for `testAliasDidNotDisappears`.
|
|
||||||
*/
|
|
||||||
public static function dataProviderAliasDidNotDisappears()
|
|
||||||
{
|
|
||||||
$datas = static::getFormData();
|
|
||||||
|
|
||||||
if (!\is_array($datas)) {
|
|
||||||
$datas = iterator_to_array($datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (static::getQueryBuilders() as $qb) {
|
|
||||||
if ([] === $datas) {
|
|
||||||
yield [clone $qb, []];
|
|
||||||
} else {
|
|
||||||
foreach (static::getFormData() as $data) {
|
|
||||||
yield [clone $qb, $data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of data to normalize.
|
|
||||||
*
|
|
||||||
* @return iterable{array}
|
|
||||||
*/
|
|
||||||
public static function dataProviderFormDataToNormalize(): iterable
|
|
||||||
{
|
|
||||||
foreach (static::getFormData() as $data) {
|
|
||||||
yield [$data, 1, []];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* provide data for `testAlterQuery`.
|
|
||||||
*/
|
|
||||||
public static function dataProviderAlterQuery()
|
|
||||||
{
|
|
||||||
$datas = static::getFormData();
|
|
||||||
|
|
||||||
if (!\is_array($datas)) {
|
|
||||||
$datas = iterator_to_array($datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (static::getQueryBuilders() as $qb) {
|
|
||||||
if ([] === $datas) {
|
|
||||||
yield [clone $qb, []];
|
|
||||||
} else {
|
|
||||||
foreach (static::getFormData() as $data) {
|
|
||||||
yield [clone $qb, $data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function dataProviderQueryExecution(): iterable
|
|
||||||
{
|
|
||||||
$datas = static::getFormData();
|
|
||||||
|
|
||||||
if (!\is_array($datas)) {
|
|
||||||
$datas = iterator_to_array($datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (static::getQueryBuilders() as $qb) {
|
|
||||||
if ([] === $datas) {
|
|
||||||
yield [clone $qb, []];
|
|
||||||
} else {
|
|
||||||
foreach (static::getFormData() as $data) {
|
|
||||||
yield [clone $qb, $data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* prepare data for `testGetQueryKeys`.
|
|
||||||
*/
|
|
||||||
public static function dataProviderGetQueryKeys()
|
|
||||||
{
|
|
||||||
$datas = static::getFormData();
|
|
||||||
|
|
||||||
if (!\is_array($datas)) {
|
|
||||||
$datas = iterator_to_array($datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($datas as $data) {
|
|
||||||
yield [$data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* prepare date for method `testGetResultsAndLabels`.
|
|
||||||
*/
|
|
||||||
public static function dataProviderGetResultsAndLabels()
|
|
||||||
{
|
|
||||||
$datas = static::getFormData();
|
|
||||||
|
|
||||||
if (!\is_array($datas)) {
|
|
||||||
$datas = iterator_to_array($datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (static::getQueryBuilders() as $qb) {
|
|
||||||
if ([] === $datas) {
|
|
||||||
yield [clone $qb, []];
|
|
||||||
} else {
|
|
||||||
foreach ($datas as $data) {
|
|
||||||
yield [clone $qb, $data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aggregator instance which will be used in tests.
|
* Create an aggregator instance which will be used in tests.
|
||||||
*
|
*
|
||||||
@ -214,6 +101,28 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* provide data for `testAliasDidNotDisappears`.
|
||||||
|
*/
|
||||||
|
public static function dataProviderAliasDidNotDisappears()
|
||||||
|
{
|
||||||
|
$datas = static::getFormData();
|
||||||
|
|
||||||
|
if (!\is_array($datas)) {
|
||||||
|
$datas = iterator_to_array($datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (static::getQueryBuilders() as $qb) {
|
||||||
|
if ([] === $datas) {
|
||||||
|
yield [clone $qb, []];
|
||||||
|
} else {
|
||||||
|
foreach (static::getFormData() as $data) {
|
||||||
|
yield [clone $qb, $data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider dataProviderQueryExecution
|
* @dataProvider dataProviderQueryExecution
|
||||||
*
|
*
|
||||||
@ -228,6 +137,25 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
self::assertIsArray($actual);
|
self::assertIsArray($actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dataProviderQueryExecution(): iterable
|
||||||
|
{
|
||||||
|
$datas = static::getFormData();
|
||||||
|
|
||||||
|
if (!\is_array($datas)) {
|
||||||
|
$datas = iterator_to_array($datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (static::getQueryBuilders() as $qb) {
|
||||||
|
if ([] === $datas) {
|
||||||
|
yield [clone $qb, []];
|
||||||
|
} else {
|
||||||
|
foreach (static::getFormData() as $data) {
|
||||||
|
yield [clone $qb, $data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the alteration of query by the filter.
|
* test the alteration of query by the filter.
|
||||||
*
|
*
|
||||||
@ -266,6 +194,28 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* provide data for `testAlterQuery`.
|
||||||
|
*/
|
||||||
|
public static function dataProviderAlterQuery()
|
||||||
|
{
|
||||||
|
$datas = static::getFormData();
|
||||||
|
|
||||||
|
if (!\is_array($datas)) {
|
||||||
|
$datas = iterator_to_array($datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (static::getQueryBuilders() as $qb) {
|
||||||
|
if ([] === $datas) {
|
||||||
|
yield [clone $qb, []];
|
||||||
|
} else {
|
||||||
|
foreach (static::getFormData() as $data) {
|
||||||
|
yield [clone $qb, $data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the `applyOn` method.
|
* Test the `applyOn` method.
|
||||||
*/
|
*/
|
||||||
@ -309,6 +259,18 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of data to normalize.
|
||||||
|
*
|
||||||
|
* @return iterable{array}
|
||||||
|
*/
|
||||||
|
public static function dataProviderFormDataToNormalize(): iterable
|
||||||
|
{
|
||||||
|
foreach (static::getFormData() as $data) {
|
||||||
|
yield [$data, 1, []];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that the query keys are strings.
|
* Test that the query keys are strings.
|
||||||
*
|
*
|
||||||
@ -335,6 +297,22 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* prepare data for `testGetQueryKeys`.
|
||||||
|
*/
|
||||||
|
public static function dataProviderGetQueryKeys()
|
||||||
|
{
|
||||||
|
$datas = static::getFormData();
|
||||||
|
|
||||||
|
if (!\is_array($datas)) {
|
||||||
|
$datas = iterator_to_array($datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
yield [$data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that.
|
* Test that.
|
||||||
*
|
*
|
||||||
@ -399,6 +377,28 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* prepare date for method `testGetResultsAndLabels`.
|
||||||
|
*/
|
||||||
|
public static function dataProviderGetResultsAndLabels()
|
||||||
|
{
|
||||||
|
$datas = static::getFormData();
|
||||||
|
|
||||||
|
if (!\is_array($datas)) {
|
||||||
|
$datas = iterator_to_array($datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (static::getQueryBuilders() as $qb) {
|
||||||
|
if ([] === $datas) {
|
||||||
|
yield [clone $qb, []];
|
||||||
|
} else {
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
yield [clone $qb, $data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the `getTitle` method.
|
* test the `getTitle` method.
|
||||||
*/
|
*/
|
||||||
|
@ -33,39 +33,6 @@ abstract class AbstractExportTest extends WebTestCase
|
|||||||
{
|
{
|
||||||
use PrepareClientTrait;
|
use PrepareClientTrait;
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of data to normalize.
|
|
||||||
*
|
|
||||||
* @return iterable{array}
|
|
||||||
*/
|
|
||||||
public static function dataProviderFormDataToNormalize(): iterable
|
|
||||||
{
|
|
||||||
foreach (static::getFormData() as $data) {
|
|
||||||
yield [$data, 1, []];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function dataProviderGetQueryKeys()
|
|
||||||
{
|
|
||||||
foreach (static::getFormData() as $data) {
|
|
||||||
yield [$data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create data for `ìnitiateQuery` method.
|
|
||||||
*/
|
|
||||||
public static function dataProviderInitiateQuery()
|
|
||||||
{
|
|
||||||
$acl = static::getAcl();
|
|
||||||
|
|
||||||
foreach (static::getModifiersCombination() as $modifiers) {
|
|
||||||
foreach (static::getFormData() as $data) {
|
|
||||||
yield [$modifiers, $acl, $data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array usable as ACL.
|
* Return an array usable as ACL.
|
||||||
*
|
*
|
||||||
@ -182,6 +149,18 @@ abstract class AbstractExportTest extends WebTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of data to normalize.
|
||||||
|
*
|
||||||
|
* @return iterable{array}
|
||||||
|
*/
|
||||||
|
public static function dataProviderFormDataToNormalize(): iterable
|
||||||
|
{
|
||||||
|
foreach (static::getFormData() as $data) {
|
||||||
|
yield [$data, 1, []];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function testOneDataNormalization(ExportInterface|DirectExportInterface $export, array $data, int $version, array $customAssert): void
|
private function testOneDataNormalization(ExportInterface|DirectExportInterface $export, array $data, int $version, array $customAssert): void
|
||||||
{
|
{
|
||||||
$normalized = $export->normalizeFormData($data);
|
$normalized = $export->normalizeFormData($data);
|
||||||
@ -262,6 +241,13 @@ abstract class AbstractExportTest extends WebTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dataProviderGetQueryKeys()
|
||||||
|
{
|
||||||
|
foreach (static::getFormData() as $data) {
|
||||||
|
yield [$data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that.
|
* Test that.
|
||||||
*
|
*
|
||||||
@ -446,4 +432,18 @@ abstract class AbstractExportTest extends WebTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create data for `ìnitiateQuery` method.
|
||||||
|
*/
|
||||||
|
public static function dataProviderInitiateQuery()
|
||||||
|
{
|
||||||
|
$acl = static::getAcl();
|
||||||
|
|
||||||
|
foreach (static::getModifiersCombination() as $modifiers) {
|
||||||
|
foreach (static::getFormData() as $data) {
|
||||||
|
yield [$modifiers, $acl, $data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,61 +35,6 @@ abstract class AbstractFilterTest extends KernelTestCase
|
|||||||
self::ensureKernelShutdown();
|
self::ensureKernelShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* provide data for `testAliasDidNotDisappears`.
|
|
||||||
*/
|
|
||||||
public static function dataProviderAliasDidNotDisappears()
|
|
||||||
{
|
|
||||||
$datas = static::getFormData();
|
|
||||||
|
|
||||||
foreach (static::getQueryBuilders() as $qb) {
|
|
||||||
if ([] === $datas) {
|
|
||||||
yield [clone $qb, []];
|
|
||||||
} else {
|
|
||||||
foreach ($datas as $data) {
|
|
||||||
yield [clone $qb, $data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function dataProviderAlterQuery()
|
|
||||||
{
|
|
||||||
$datas = static::getFormData();
|
|
||||||
|
|
||||||
foreach (static::getQueryBuilders() as $qb) {
|
|
||||||
if ([] === $datas) {
|
|
||||||
yield [clone $qb, []];
|
|
||||||
} else {
|
|
||||||
foreach ($datas as $data) {
|
|
||||||
yield [clone $qb, $data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function dataProvideQueryExecution(): iterable
|
|
||||||
{
|
|
||||||
$datas = static::getFormData();
|
|
||||||
|
|
||||||
foreach (static::getQueryBuilders() as $qb) {
|
|
||||||
if ([] === $datas) {
|
|
||||||
yield [clone $qb, []];
|
|
||||||
} else {
|
|
||||||
foreach ($datas as $data) {
|
|
||||||
yield [clone $qb, $data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function dataProviderDescriptionAction()
|
|
||||||
{
|
|
||||||
foreach (static::getFormData() as $data) {
|
|
||||||
yield [$data];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getUser(): User
|
protected function getUser(): User
|
||||||
{
|
{
|
||||||
$em = static::getContainer()->get(EntityManagerInterface::class);
|
$em = static::getContainer()->get(EntityManagerInterface::class);
|
||||||
@ -134,18 +79,6 @@ abstract class AbstractFilterTest extends KernelTestCase
|
|||||||
*/
|
*/
|
||||||
abstract public static function getQueryBuilders();
|
abstract public static function getQueryBuilders();
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of data to normalize.
|
|
||||||
*
|
|
||||||
* @return iterable{array}
|
|
||||||
*/
|
|
||||||
public static function dataProviderFormDataToNormalize(): iterable
|
|
||||||
{
|
|
||||||
foreach (static::getFormData() as $data) {
|
|
||||||
yield [$data, 1, []];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider dataProviderFormDataToNormalize
|
* @dataProvider dataProviderFormDataToNormalize
|
||||||
*/
|
*/
|
||||||
@ -172,6 +105,18 @@ abstract class AbstractFilterTest extends KernelTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of data to normalize.
|
||||||
|
*
|
||||||
|
* @return iterable{array}
|
||||||
|
*/
|
||||||
|
public static function dataProviderFormDataToNormalize(): iterable
|
||||||
|
{
|
||||||
|
foreach (static::getFormData() as $data) {
|
||||||
|
yield [$data, 1, []];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare aliases array before and after that filter alter query.
|
* Compare aliases array before and after that filter alter query.
|
||||||
*
|
*
|
||||||
@ -192,6 +137,24 @@ abstract class AbstractFilterTest extends KernelTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* provide data for `testAliasDidNotDisappears`.
|
||||||
|
*/
|
||||||
|
public static function dataProviderAliasDidNotDisappears()
|
||||||
|
{
|
||||||
|
$datas = static::getFormData();
|
||||||
|
|
||||||
|
foreach (static::getQueryBuilders() as $qb) {
|
||||||
|
if ([] === $datas) {
|
||||||
|
yield [clone $qb, []];
|
||||||
|
} else {
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
yield [clone $qb, $data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the alteration of query by the filter.
|
* test the alteration of query by the filter.
|
||||||
*
|
*
|
||||||
@ -232,6 +195,21 @@ abstract class AbstractFilterTest extends KernelTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dataProviderAlterQuery()
|
||||||
|
{
|
||||||
|
$datas = static::getFormData();
|
||||||
|
|
||||||
|
foreach (static::getQueryBuilders() as $qb) {
|
||||||
|
if ([] === $datas) {
|
||||||
|
yield [clone $qb, []];
|
||||||
|
} else {
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
yield [clone $qb, $data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider dataProvideQueryExecution
|
* @dataProvider dataProvideQueryExecution
|
||||||
*/
|
*/
|
||||||
@ -244,6 +222,21 @@ abstract class AbstractFilterTest extends KernelTestCase
|
|||||||
self::assertIsArray($actual);
|
self::assertIsArray($actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dataProvideQueryExecution(): iterable
|
||||||
|
{
|
||||||
|
$datas = static::getFormData();
|
||||||
|
|
||||||
|
foreach (static::getQueryBuilders() as $qb) {
|
||||||
|
if ([] === $datas) {
|
||||||
|
yield [clone $qb, []];
|
||||||
|
} else {
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
yield [clone $qb, $data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function testApplyOn()
|
public function testApplyOn()
|
||||||
{
|
{
|
||||||
$filter = $this->getFilter();
|
$filter = $this->getFilter();
|
||||||
@ -308,4 +301,11 @@ abstract class AbstractFilterTest extends KernelTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dataProviderDescriptionAction()
|
||||||
|
{
|
||||||
|
foreach (static::getFormData() as $data) {
|
||||||
|
yield [$data];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,18 +61,6 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of data to normalize.
|
|
||||||
*
|
|
||||||
* @return iterable{array}
|
|
||||||
*/
|
|
||||||
public static function dataProviderFormDataToNormalize(): iterable
|
|
||||||
{
|
|
||||||
foreach (self::getFormData() as $data) {
|
|
||||||
yield [$data, 1, []];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider dataProviderFormDataToNormalize
|
* @dataProvider dataProviderFormDataToNormalize
|
||||||
*/
|
*/
|
||||||
@ -85,4 +73,16 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
|||||||
|
|
||||||
self::assertIsArray($actual);
|
self::assertIsArray($actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of data to normalize.
|
||||||
|
*
|
||||||
|
* @return iterable{array}
|
||||||
|
*/
|
||||||
|
public static function dataProviderFormDataToNormalize(): iterable
|
||||||
|
{
|
||||||
|
foreach (self::getFormData() as $data) {
|
||||||
|
yield [$data, 1, []];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,20 @@ final class GenderFilterTest extends AbstractFilterTest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider dataProviderFormDataToNormalize
|
||||||
|
*/
|
||||||
|
public function testDataNormalization(array $data, int $version, array $customAssert): void
|
||||||
|
{
|
||||||
|
$filter = $this->getFilter();
|
||||||
|
|
||||||
|
$normalized = $filter->normalizeFormData($data);
|
||||||
|
$actual = $filter->denormalizeFormData($normalized, $version);
|
||||||
|
|
||||||
|
self::assertIsArray($actual);
|
||||||
|
self::assertArrayHasKey('accepted_genders_entity', $actual);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of data to normalize.
|
* A list of data to normalize.
|
||||||
*
|
*
|
||||||
@ -65,20 +79,6 @@ final class GenderFilterTest extends AbstractFilterTest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @dataProvider dataProviderFormDataToNormalize
|
|
||||||
*/
|
|
||||||
public function testDataNormalization(array $data, int $version, array $customAssert): void
|
|
||||||
{
|
|
||||||
$filter = $this->getFilter();
|
|
||||||
|
|
||||||
$normalized = $filter->normalizeFormData($data);
|
|
||||||
$actual = $filter->denormalizeFormData($normalized, $version);
|
|
||||||
|
|
||||||
self::assertIsArray($actual);
|
|
||||||
self::assertArrayHasKey('accepted_genders_entity', $actual);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getQueryBuilders(): iterable
|
public static function getQueryBuilders(): iterable
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user