// The field still exists, deleted.
$fields = \Drupal::
entityTypeManager()->
getStorage('field_config'
)->
loadByProperties(['field_storage_uuid' =>
$field_storage->
uuid(), 'deleted' => TRUE, 'include_deleted' => TRUE
]);
$this->
assertCount(1,
$fields, 'There is one deleted field'
);
$field =
$fields[$field->
uuid()];
$this->
assertEquals($bundle,
$field->
getTargetBundle(), 'The deleted field is for the correct bundle'
);
// Check that the actual stored content did not change during delete.
/** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
$table_mapping =
$storage->
getTableMapping();
$table =
$table_mapping->
getDedicatedDataTableName($field_storage);
$column =
$table_mapping->
getFieldColumnName($field_storage, 'value'
);
$result = Database::
getConnection()->
select($table, 't'
) ->
fields('t'
) ->
execute();
foreach ($result as $row) { $this->
assertEquals($row->
{$column},
$this->entities
[$row->entity_id
]->
{$field_name}->value
);
} // There are 0 entities of this bundle with non-deleted data.
$found =
$storage ->
getQuery() ->
accessCheck(FALSE
)