You are here

public function EntitySchemaTest::testModifyingTranslatableColumnSchema in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php \Drupal\KernelTests\Core\Entity\EntitySchemaTest::testModifyingTranslatableColumnSchema()

Tests that modifying the UUID field for a translatable entity works.

File

core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php, line 305

Class

EntitySchemaTest
Tests the default entity storage schema handler.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testModifyingTranslatableColumnSchema() {
  $this
    ->installModule('entity_schema_test');
  $this
    ->updateEntityType(TRUE);
  $fields = [
    'revision_log',
    'uuid',
  ];
  $entity_field_manager = \Drupal::service('entity_field.manager');
  foreach ($fields as $field_name) {
    $original_definition = $entity_field_manager
      ->getBaseFieldDefinitions('entity_test_update')[$field_name];
    $new_definition = clone $original_definition;
    $new_definition
      ->setLabel($original_definition
      ->getLabel() . ', the other one');
    $this
      ->assertTrue($this->entityTypeManager
      ->getStorage('entity_test_update')
      ->requiresFieldDataMigration($new_definition, $original_definition));
  }
}