You are here

protected function FieldableEntityDefinitionUpdateTest::assertBundleFieldSchema in Drupal 8

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

Asserts that the bundle field schema is correct.

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 617

Class

FieldableEntityDefinitionUpdateTest
Tests EntityDefinitionUpdateManager's fieldable entity update functionality.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function assertBundleFieldSchema($revisionable) {
  $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)));
  }
}