You are here

protected function EntityDefinitionTestTrait::doFieldUpdate in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Entity/Traits/EntityDefinitionTestTrait.php \Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait::doFieldUpdate()
  2. 9 core/modules/system/tests/src/Functional/Entity/Traits/EntityDefinitionTestTrait.php \Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait::doFieldUpdate()

Performs a field storage definition update.

Parameters

string $op: The operation to perform, possible values are static::DEFINITION_CREATED, static::DEFINITION_UPDATED or static::DEFINITION_DELETED.

array|null $storage_definition: The new field storage definition.

array|null $original_storage_definition: The original field storage definition.

1 call to EntityDefinitionTestTrait::doFieldUpdate()
EntityDefinitionTestTrait::applyEntityUpdates in core/modules/system/tests/src/Functional/Entity/Traits/EntityDefinitionTestTrait.php
Applies all the detected valid changes.

File

core/modules/system/tests/src/Functional/Entity/Traits/EntityDefinitionTestTrait.php, line 97

Class

EntityDefinitionTestTrait
Provides some test methods used to update existing entity definitions.

Namespace

Drupal\Tests\system\Functional\Entity\Traits

Code

protected function doFieldUpdate($op, $storage_definition = NULL, $original_storage_definition = NULL) {
  switch ($op) {
    case EntityDefinitionUpdateManagerInterface::DEFINITION_CREATED:
      \Drupal::service('field_storage_definition.listener')
        ->onFieldStorageDefinitionCreate($storage_definition);
      break;
    case EntityDefinitionUpdateManagerInterface::DEFINITION_UPDATED:
      \Drupal::service('field_storage_definition.listener')
        ->onFieldStorageDefinitionUpdate($storage_definition, $original_storage_definition);
      break;
    case EntityDefinitionUpdateManagerInterface::DEFINITION_DELETED:
      \Drupal::service('field_storage_definition.listener')
        ->onFieldStorageDefinitionDelete($original_storage_definition);
      break;
  }
}