'field_name' => 'field_int',
'entity_type' => 'entity_test',
'type' => 'integer',
'cardinality' => 2,
]);
$field_storage->
save();
FieldConfig::
create([ 'field_storage' =>
$field_storage,
'bundle' => 'entity_test',
])->
save();
$this->
assertFalse($field_storage->
hasdata(), 'There are no entities with field data.'
);
$this->
assertSame(0,
$this->storage->
countFieldData($field_storage), 'There are 0 entities with field data.'
);
// Create 1 entity without the field.
$entity = EntityTest::
create();
$entity->name->value =
$this->
randomMachineName();
$entity->
save();
$this->
assertFalse($field_storage->
hasdata(), 'There are no entities with field data.'
);
$this->
assertSame(0,
$this->storage->
countFieldData($field_storage), 'There are 0 entities with field data.'
);
// Create 12 entities to ensure that the purging works as expected.