diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2LocationTypeType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2LocationTypeType.php index e680b06ca..783ec4e5c 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2LocationTypeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2LocationTypeType.php @@ -1,5 +1,14 @@ setDefault('label', 'Location type') ->setDefault('label_attr', []) ->setDefault('multiple', false) - ->setAllowedTypes('multiple', ['bool']) - ; + ->setAllowedTypes('multiple', ['bool']); } public function getBlockPrefix(): string diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2UserLocationType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2UserLocationType.php index de4a8537d..8fb100441 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2UserLocationType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2UserLocationType.php @@ -57,8 +57,7 @@ class Select2UserLocationType extends AbstractType ->setDefault('label', 'Current location') ->setDefault('label_attr', []) ->setDefault('multiple', false) - ->setAllowedTypes('multiple', ['bool']) - ; + ->setAllowedTypes('multiple', ['bool']); } public function getBlockPrefix(): string diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php index d3f2849b7..af0e3843a 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php @@ -29,6 +29,18 @@ use function is_string; */ abstract class AbstractAggregatorTest extends KernelTestCase { + /** + * provide data for `testAliasDidNotDisappears`. + */ + public function dataProviderAliasDidNotDisappears() + { + foreach ($this->getQueryBuilders() as $qb) { + foreach ($this->getFormData() as $data) { + yield [clone $qb, $data]; + } + } + } + /** * provide data for `testAlterQuery`. */ @@ -63,18 +75,6 @@ abstract class AbstractAggregatorTest extends KernelTestCase } } - /** - * provide data for `testAliasDidNotDisappears`. - */ - public function dataProviderAliasDidNotDisappears() - { - foreach ($this->getQueryBuilders() as $qb) { - foreach ($this->getFormData() as $data) { - yield [clone $qb, $data]; - } - } - } - /** * Create an aggregator instance which will be used in tests. * @@ -107,6 +107,28 @@ abstract class AbstractAggregatorTest extends KernelTestCase */ abstract public function getQueryBuilders(); + /** + * Compare aliases array before and after that aggregator alter query. + * + * @dataProvider dataProviderAliasDidNotDisappears + * + * @return void + */ + public function testAliasDidNotDisappears(QueryBuilder $qb, array $data) + { + $aliases = $qb->getAllAliases(); + + $this->getAggregator()->alterQuery($qb, $data); + + $alteredQuery = $qb->getAllAliases(); + + $this->assertGreaterThanOrEqual(count($aliases), count($alteredQuery)); + + foreach ($aliases as $alias) { + $this->assertContains($alias, $alteredQuery); + } + } + /** * test the alteration of query by the filter. * @@ -269,29 +291,4 @@ abstract class AbstractAggregatorTest extends KernelTestCase 'test that the title is not empty' ); } - - /** - * Compare aliases array before and after that aggregator alter query - * - * @dataProvider dataProviderAliasDidNotDisappears - * - * @param QueryBuilder $qb - * @param array $data - * @return void - */ - public function testAliasDidNotDisappears(QueryBuilder $qb, array $data) - { - $aliases = $qb->getAllAliases(); - - $this->getAggregator()->alterQuery($qb, $data); - - $alteredQuery = $qb->getAllAliases(); - - $this->assertGreaterThanOrEqual(count($aliases), count($alteredQuery)); - - foreach ($aliases as $alias) { - $this->assertContains($alias, $alteredQuery); - } - } - } diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php index 8e8220b89..e1c8665ec 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php @@ -40,6 +40,18 @@ abstract class AbstractFilterTest extends KernelTestCase $this->prophet = $this->getProphet(); } + /** + * provide data for `testAliasDidNotDisappears`. + */ + public function dataProviderAliasDidNotDisappears() + { + foreach ($this->getQueryBuilders() as $qb) { + foreach ($this->getFormData() as $data) { + yield [clone $qb, $data]; + } + } + } + public function dataProviderAlterQuery() { foreach ($this->getQueryBuilders() as $qb) { @@ -56,18 +68,6 @@ abstract class AbstractFilterTest extends KernelTestCase } } - /** - * provide data for `testAliasDidNotDisappears`. - */ - public function dataProviderAliasDidNotDisappears() - { - foreach ($this->getQueryBuilders() as $qb) { - foreach ($this->getFormData() as $data) { - yield [clone $qb, $data]; - } - } - } - /** * Create a filter which will be used in tests. * @@ -99,6 +99,28 @@ abstract class AbstractFilterTest extends KernelTestCase */ abstract public function getQueryBuilders(); + /** + * Compare aliases array before and after that filter alter query. + * + * @dataProvider dataProviderAliasDidNotDisappears + * + * @return void + */ + public function testAliasDidNotDisappears(QueryBuilder $qb, array $data) + { + $aliases = $qb->getAllAliases(); + + $this->getFilter()->alterQuery($qb, $data); + + $alteredQuery = $qb->getAllAliases(); + + $this->assertGreaterThanOrEqual(count($aliases), count($alteredQuery)); + + foreach ($aliases as $alias) { + $this->assertContains($alias, $alteredQuery); + } + } + /** * test the alteration of query by the filter. * @@ -211,28 +233,4 @@ abstract class AbstractFilterTest extends KernelTestCase 'test that the title is not empty' ); } - - /** - * Compare aliases array before and after that filter alter query - * - * @dataProvider dataProviderAliasDidNotDisappears - * - * @param QueryBuilder $qb - * @param array $data - * @return void - */ - public function testAliasDidNotDisappears(QueryBuilder $qb, array $data) - { - $aliases = $qb->getAllAliases(); - - $this->getFilter()->alterQuery($qb, $data); - - $alteredQuery = $qb->getAllAliases(); - - $this->assertGreaterThanOrEqual(count($aliases), count($alteredQuery)); - - foreach ($aliases as $alias) { - $this->assertContains($alias, $alteredQuery); - } - } } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php index 9e54a2272..d289220af 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php @@ -20,7 +20,6 @@ use Symfony\Component\Form\FormBuilderInterface; class AdministrativeLocationFilter implements FilterInterface { - private TranslatableStringHelper $translatableStringHelper; public function __construct( @@ -49,7 +48,6 @@ class AdministrativeLocationFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('accepted_locations', Select2UserLocationType::class, [ 'label' => 'Accepted locations', 'label_attr' => [