$values_2[1
]['value'
] = 0;
// Pretend the form has been built.
$form_state->
setFormObject(\Drupal::
entityTypeManager()->
getFormObject($entity_type, 'default'
));
\Drupal::
formBuilder()->
prepareForm('field_test_entity_form',
$form,
$form_state);
\Drupal::
formBuilder()->
processForm('field_test_entity_form',
$form,
$form_state);
$form_state->
setValue($this->fieldTestData->field_name,
$values);
$form_state->
setValue($this->fieldTestData->field_name_2,
$values_2);
// Extract values for all fields.
$entity =
clone($entity_init);
$display->
extractFormValues($entity,
$form,
$form_state);
asort($weights);
asort($weights_2);
$expected_values =
[];
$expected_values_2 =
[];
foreach ($weights as $key =>
$value) { if ($key != 1
) { $expected_values[] =
['value' =>
$values[$key]['value'
]];
} } $this->
assertSame($expected_values,
$entity->
{$this->fieldTestData->field_name
}->
getValue(), 'Submit filters empty values'
);