$entity->
getTargetEntityTypeId()->
willReturn('entity_test_with_bundle'
);
$entity->
getTargetBundle()->
willReturn('target_bundle'
);
// An initially hidden field, with a submitted region change.
$entity->
getComponent('new_field_mismatch_type_visible'
)->
willReturn([]);
$field_values['new_field_mismatch_type_visible'
] =
[ 'weight' => 0,
'type' => 'textfield',
'region' => 'hidden',
];
$entity->
removeComponent('new_field_mismatch_type_visible'
) ->
will(function Darray
$args) use ($entity) { // On subsequent calls, getComponent() will return an empty array.
$entity->
getComponent($args[0
])->
willReturn([]);
}) ->
shouldBeCalled();
// An initially visible field, with identical submitted values.
$entity->
getComponent('field_visible_no_changes'
) ->
willReturn([ 'weight' => 0,
'type' => 'textfield',
'region' => 'content',
]);