// Mock the base field definition override.
$override_entity_type =
$this->
prophesize(EntityTypeInterface::
class);
$this->entityType =
$this->
prophesize(EntityTypeInterface::
class);
$this->
setUpEntityTypeDefinitions(['test_entity_type' =>
$this->entityType, 'base_field_override' =>
$override_entity_type]);
$storage =
$this->
prophesize(EntityStorageInterface::
class);
$storage->
loadMultiple(Argument::
type('array'
))->
willReturn([]);
// By default, make the storage entity class lookup return the
// EntityTypeManagerTestEntity class
$storage->
getEntityClass(NULL
)->
willReturn(EntityTypeManagerTestEntity::
class);
$storage->
getEntityClass(Argument::
type('string'
))->
willReturn(EntityTypeManagerTestEntity::
class);
// When using the "test_entity_bundle_class" bundle, return the
// EntityTypeManagerTestEntityBundle class
$storage->
getEntityClass('test_entity_bundle_class'
)->
willReturn(EntityTypeManagerTestEntityBundle::
class);
$this->entityTypeManager->
getStorage('test_entity_type'
)->
willReturn($storage->
reveal());
$this->entityTypeManager->
getStorage('base_field_override'
)->
willReturn($storage->
reveal());
$this->entityType->
getClass()->
willReturn($entity_class);
$this->entityType->
getKeys()->
willReturn($entity_keys +
['default_langcode' => 'default_langcode'
]);
$this->entityType->
entityClassImplements(FieldableEntityInterface::
class)->
willReturn(TRUE
);