function EntityDefinitionTestTrait::updateEntityTypeToRevisionable

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Entity/Traits/EntityDefinitionTestTrait.php \Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait::updateEntityTypeToRevisionable()
  2. 8.9.x core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php \Drupal\system\Tests\Entity\EntityDefinitionTestTrait::updateEntityTypeToRevisionable()
  3. 8.9.x core/modules/system/tests/src/Functional/Entity/Traits/EntityDefinitionTestTrait.php \Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait::updateEntityTypeToRevisionable()
  4. 11.x core/modules/system/tests/src/Functional/Entity/Traits/EntityDefinitionTestTrait.php \Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait::updateEntityTypeToRevisionable()

Updates the 'entity_test_update' entity type to revisionable.

Parameters

bool $perform_update: (optional) Whether the change should be performed by the entity definition update manager.

10 calls to EntityDefinitionTestTrait::updateEntityTypeToRevisionable()
EntityDefinitionUpdateTest::testBundleFieldUpdateWithEntityTypeSchemaUpdate in core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
Tests updating a bundle field when the entity type schema has changed.
EntityDefinitionUpdateTest::testEntityTypeUpdateWithoutData in core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
Tests updating entity schema when there are no existing entities.
EntityDefinitionUpdateTest::testSingleActionCalls in core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
Tests applying single updates.
EntityDefinitionUpdateTest::testUninstallRevisionableEntityTypeWithoutInCodeDefinition in core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
Tests uninstalling a revisionable entity type that doesn't exist in code.
ViewsEntitySchemaSubscriberIntegrationTest::testDeleteEntityType in core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php
Tests that views are disabled when an entity type is deleted.

... See full list

File

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

Class

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

Namespace

Drupal\Tests\system\Functional\Entity\Traits

Code

protected function updateEntityTypeToRevisionable($perform_update = FALSE) {
    $translatable = $this->entityDefinitionUpdateManager
        ->getEntityType('entity_test_update')
        ->isTranslatable();
    $updated_entity_type = $this->getUpdatedEntityTypeDefinition(TRUE, $translatable);
    $updated_field_storage_definitions = $this->getUpdatedFieldStorageDefinitions(TRUE, $translatable);
    if ($perform_update) {
        $this->entityDefinitionUpdateManager
            ->updateFieldableEntityType($updated_entity_type, $updated_field_storage_definitions);
    }
}

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