You are here

public function EntityDefinitionUpdateTest::testEntityTypeUpdateWithEntityStorageChange in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testEntityTypeUpdateWithEntityStorageChange()
  2. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testEntityTypeUpdateWithEntityStorageChange()

Tests updating entity schema when there are entity storage changes.

File

core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php, line 138

Class

EntityDefinitionUpdateTest
Tests EntityDefinitionUpdateManager functionality.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testEntityTypeUpdateWithEntityStorageChange() {

  // Update the entity type to be revisionable and try to apply the update.
  // It's expected to throw an exception.
  $entity_type = $this
    ->getUpdatedEntityTypeDefinition(TRUE, FALSE);
  try {
    $this->entityDefinitionUpdateManager
      ->updateEntityType($entity_type);
    $this
      ->fail('EntityStorageException thrown when trying to apply an update that requires shared table schema changes.');
  } catch (EntityStorageException $e) {

    // Expected exception; just continue testing.
  }
}