function FieldableEntityDefinitionUpdateTest::assertBundleFieldSchema

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\FieldableEntityDefinitionUpdateTest::assertBundleFieldSchema()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\FieldableEntityDefinitionUpdateTest::assertBundleFieldSchema()
  3. 11.x core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\FieldableEntityDefinitionUpdateTest::assertBundleFieldSchema()

Asserts that the bundle field schema is correct.

@internal

Parameters

bool $revisionable: Whether the entity type is revisionable or not.

1 call to FieldableEntityDefinitionUpdateTest::assertBundleFieldSchema()
FieldableEntityDefinitionUpdateTest::assertEntityTypeSchema in core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php
Asserts revisionable and/or translatable characteristics of an entity type.

File

core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php, line 479

Class

FieldableEntityDefinitionUpdateTest
Tests EntityDefinitionUpdateManager's fieldable entity update functionality.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function assertBundleFieldSchema(bool $revisionable) : void {
  $entity_type_id = 'entity_test_update';
  $field_storage_definition = $this->entityFieldManager
    ->getFieldStorageDefinitions($entity_type_id)['new_bundle_field'];
  $database_schema = $this->database
    ->schema();
  /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
  $table_mapping = $this->entityTypeManager
    ->getStorage($entity_type_id)
    ->getTableMapping();
  $this->assertTrue($database_schema->tableExists($table_mapping->getDedicatedDataTableName($field_storage_definition)));
  if ($revisionable) {
    $this->assertTrue($database_schema->tableExists($table_mapping->getDedicatedRevisionTableName($field_storage_definition)));
  }
}

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