function EntityDefinitionUpdateTest::testUpdateEntityTypeWithoutInCodeDefinition

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testUpdateEntityTypeWithoutInCodeDefinition()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testUpdateEntityTypeWithoutInCodeDefinition()
  3. 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testUpdateEntityTypeWithoutInCodeDefinition()

Tests updating an entity type that doesn't exist in code anymore.

@covers ::updateEntityType

File

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

Class

EntityDefinitionUpdateTest
Tests EntityDefinitionUpdateManager functionality.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testUpdateEntityTypeWithoutInCodeDefinition() {
    $entity_type = clone $this->entityTypeManager
        ->getDefinition('entity_test_update');
    // Remove the entity type definition. This is the same thing as removing the
    // code that defines it.
    $this->deleteEntityType();
    // Add an entity index, update the entity type and check that the index has
    // been created.
    $this->addEntityIndex();
    $this->entityDefinitionUpdateManager
        ->updateEntityType($entity_type);
    $this->assertTrue($this->database
        ->schema()
        ->indexExists('entity_test_update', 'entity_test_update__new_index'), 'Index created.');
}

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