Regenerate data from saved export on formatter test

[ci-skip]
This commit is contained in:
2023-06-04 01:10:50 +02:00
parent fb0afc7e0a
commit cb0a6bbd21
4 changed files with 71 additions and 23 deletions

View File

@@ -173,7 +173,19 @@ class SpreadSheetFormatter implements FormatterInterface
}
}
public function getName()
public function getFormDefaultData(array $aggregatorAliases): array
{
$data = ['format' => 'xlsx'];
$aggregators = iterator_to_array($this->exportManager->getAggregators($aggregatorAliases));
foreach (array_keys($aggregators) as $index => $alias) {
$data[$alias] = ['order' => $index + 1];
}
return $data;
}
public function getName(): string
{
return 'SpreadSheet (xlsx, ods)';
}
@@ -185,7 +197,7 @@ class SpreadSheetFormatter implements FormatterInterface
array $exportData,
array $filtersData,
array $aggregatorsData
) {
): Response {
// store all data when the process is initiated
$this->result = $result;
$this->formatterData = $formatterData;
@@ -574,10 +586,8 @@ class SpreadSheetFormatter implements FormatterInterface
*
* This form allow to choose the aggregator position (row or column) and
* the ordering
*
* @param string $nbAggregators
*/
private function appendAggregatorForm(FormBuilderInterface $builder, $nbAggregators)
private function appendAggregatorForm(FormBuilderInterface $builder, int $nbAggregators): void
{
$builder->add('order', ChoiceType::class, [
'choices' => array_combine(