From 75c38e5432b8b4bd6812b787143a7efde2410b27 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Sat, 30 Sep 2023 20:33:38 -0300 Subject: [PATCH] Use multiple options by default for `RolesMatrixType` form --- src/Form/Type/RolesMatrixType.php | 1 + tests/Form/Type/RolesMatrixTypeTest.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/Form/Type/RolesMatrixType.php b/src/Form/Type/RolesMatrixType.php index 4ed59b3d4..5581b2f14 100644 --- a/src/Form/Type/RolesMatrixType.php +++ b/src/Form/Type/RolesMatrixType.php @@ -35,6 +35,7 @@ public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'expanded' => true, + 'multiple' => true, 'choices' => function (Options $options, ?array $parentChoices): array { if (null !== $parentChoices && [] !== $parentChoices) { return []; diff --git a/tests/Form/Type/RolesMatrixTypeTest.php b/tests/Form/Type/RolesMatrixTypeTest.php index d9be3b4a0..a0eef4f2d 100755 --- a/tests/Form/Type/RolesMatrixTypeTest.php +++ b/tests/Form/Type/RolesMatrixTypeTest.php @@ -58,6 +58,9 @@ public function testGetDefaultOptions(): void $choices = $options['choices']; static::assertCount(2, $choices); static::assertNotContains(UserInterface::ROLE_DEFAULT, $choices); + static::assertTrue($options['expanded']); + static::assertTrue($options['multiple']); + } public function testDifferentExcludedRoles(): void