I have a DateTimeWidget rendered by 2 fields:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('datetime', DateTimeType::class, [
'date_widget' => 'single_text',
'date_format' => 'dd/MM/yyyy',
'time_widget' => 'single_text',
]);
It generates as needed 2 field widget:
<input type="text" id="form_datetime_date" name="form[datetime][date]">
<input type="text" id="form_datetime_time" name="form[datetime][time]">
It works perfectly using the UI.
During my functional test, i want to submit the form having this input.
I tried
$form = $crawler->selectButton('my_submit')->form();
$form['form']['datetime'];
and
$form = $crawler->selectButton('my_submit')->form();
$form['form']['datetime']['date'] = new \DateTime('tomorrow');
$form['form']['datetime']['time'] = new \DateTime('tomorrow');
Writing this question I found the solution, I let it here if it can help someone