$this->
installEntitySchema('entity_test'
);
} /**
* Tests that the target entity is not unnecessarily loaded.
*/
public function testTargetEntityNoLoad() { // Setup a test entity type with an entity reference field to itself. We use
// a special storage class throwing exceptions when a load operation is
// triggered to be able to detect them.
$entity_type =
clone $this->entityTypeManager->
getDefinition('entity_test_update'
);
$entity_type->
setHandlerClass('storage', '\Drupal\entity_test\EntityTestNoLoadStorage'
);
$this->state->
set('entity_test_update.entity_type',
$entity_type);
$definitions =
[ 'target_reference' => BaseFieldDefinition::
create('entity_reference'
) ->
setSetting('target_type',
$entity_type->
id()) ->
setSetting('handler', 'default'
),
];
$this->state->
set('entity_test_update.additional_base_field_definitions',
$definitions);
$this->entityTypeManager->
clearCachedDefinitions();
$this->
installEntitySchema($entity_type->
id());
// Create the target entity.