dimanche 17 novembre 2019

Ticking a checkbox in $client->submitForm(...)

Is it possible to check a checkbox by its displayed value in a functional test when using $client->submitForm(...)? It is possible to check a checkbox by ordinal position such as:

$buttonCrawlerNode = $crawler->selectButton('submit');
$form = $buttonCrawlerNode->form();
...
$form['foo[bar]'][0]->tick();

What I'd like to do is something like this:

$client->submitForm('Submit', [
...
'foo[bar][]' => 'Ice cream',
]);

where foo[bar] is a set of checkboxes. Trying this results in

InvalidArgumentException: Unreachable field ""

'foo[bar][Ice cream]' => tick() returns

Call to undefined function ...tick()

I don't see any example in the documentation.

Aucun commentaire:

Enregistrer un commentaire