// Ensure the methods work on deleted fields.
$field_storage->
delete();
$this->
assertTrue($field_storage->
hasdata(), 'There are entities with deleted field data.'
);
$this->
assertEquals(12,
$this->storage->
countFieldData($field_storage), 'There are 12 entities with deleted field data.'
);
field_purge_batch(6
);
$this->
assertTrue($field_storage->
hasdata(), 'There are entities with deleted field data.'
);
$this->
assertEquals(6,
$this->storage->
countFieldData($field_storage), 'There are 6 entities with deleted field data.'
);
$entity_type = 'entity_test_rev';
$this->
createFieldWithStorage('_2',
$entity_type);
$entity_init =
$this->container->
get('entity_type.manager'
) ->
getStorage($entity_type) ->
create(['type' =>
$entity_type]);
$cardinality =
$this->fieldTestData->field_storage_2->
getCardinality();
$this->
assertFalse($this->fieldTestData->field_storage_2->
hasData(), 'There are no entities with field data.'
);
$this->
assertSame(0,
$this->storageRev->
countFieldData($this->fieldTestData->field_storage_2
), 'There are 0 entities with field data.'
);
// Create 1 entity with the field.
$entity =
clone($entity_init);