From ffb5441bc8a2ab33bcb59633ff4c5783d2f0232e 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 | 2 ++ 2 files changed, 3 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..f45b37f5d 100755 --- a/tests/Form/Type/RolesMatrixTypeTest.php +++ b/tests/Form/Type/RolesMatrixTypeTest.php @@ -58,6 +58,8 @@ 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