ux
ux copied to clipboard
Cannot submit values in a WebTestCase to test a Symfony UX Autocomplete field if the relation is ManyToMany
I have a form with a AutoComplete field for a ManyToMany relation:
$builder
->add('categories', CategoryAutocompleteField::class, [
'label' => 'Kategorie(n)',
'required' => true,
'class' => Category::class,
'autocomplete' => true,
'multiple' => true,
'attr' => [
'placeholder' => 'Kategorie(n) wählen',
],
])
...
I try to submit the form in a WebTestCase:
$client->submitForm('Programm erstellen', [
'program[title]' => 'Unit-Test 1',
'program[description]' => 'Unit-Test Description',
'program[durationMinutes]' => 120,
'program[categories]' => [1],
'program[startLocation]' => 1,
'program[endLocation]' => 4,
'program[enabled]' => true,
]);
When I run the test, I get the erorr InvalidArgumentException: Input "program[categories]" cannot take "1" as a value (possible values: "").
.