function EntitySchemaTest::testModifyingTranslatableColumnSchema

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php \Drupal\KernelTests\Core\Entity\EntitySchemaTest::testModifyingTranslatableColumnSchema()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php \Drupal\KernelTests\Core\Entity\EntitySchemaTest::testModifyingTranslatableColumnSchema()
  3. 11.x 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() : void {
    $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));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.