function EntityDefinitionTestTrait::updateEntityTypeToRevisionable

Same name in this branch
  1. 8.9.x core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php \Drupal\system\Tests\Entity\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. 10 core/modules/system/tests/src/Functional/Entity/Traits/EntityDefinitionTestTrait.php \Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait::updateEntityTypeToRevisionable()
  3. 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.
SqlContentEntityStorageSchemaConverterTestBase::testMakeRevisionable in core/modules/system/tests/src/Functional/Entity/Update/SqlContentEntityStorageSchemaConverterTestBase.php
Tests the conversion of an entity type to revisionable.
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 137

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.