Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot submit values in a WebTestCase to test a Symfony UX Autocomplete field if the relation is ManyToMany #2261

Open
4d4ch4u32 opened this issue Oct 11, 2024 · 0 comments

Comments

@4d4ch4u32
Copy link

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: "")..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant