Given a Type that generate this kind of HTML:
<div class="form-check">
<input
type="checkbox"
id="app_user_responsibilities_14"
name="app_user[responsibilities][]"
data-responsibility-description="A description."
class="form-check-input"
value="14">
<label class="form-check-label" for="app_user_responsibilities_14">Checkbox label</label>
</div>
How can I specifically tick it using the Symfony DOM crawler?
I tried:
$form->setValues([
'app_user[username]' => $username,
'app_user[responsibilities]' => [
14
],
]);
14
being the Responsibility
id and the value
of the input.
But I got an error when I run the test:
1) Tests\App\Controller\UserControllerTest::testCreateUserWithResponsibility14
InvalidArgumentException: Input "app_user[responsibilities][]" cannot take "14" as a value (possible values: 8).