You are here

protected function DefaultTableMappingIntegrationTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php \Drupal\KernelTests\Core\Entity\DefaultTableMappingIntegrationTest::setUp()

Overrides EntityKernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php, line 37

Class

DefaultTableMappingIntegrationTest
Tests the default table mapping class for content entities stored in SQL.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function setUp() : void {
  parent::setUp();

  // Setup some fields for entity_test_extra to create.
  $definitions['multivalued_base_field'] = BaseFieldDefinition::create('string')
    ->setName('multivalued_base_field')
    ->setTargetEntityTypeId('entity_test_mulrev')
    ->setTargetBundle('entity_test_mulrev')
    ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
    ->setTranslatable(FALSE)
    ->setRevisionable(FALSE);
  $this->state
    ->set('entity_test_mulrev.additional_base_field_definitions', $definitions);
  $this->tableMapping = $this->entityTypeManager
    ->getStorage('entity_test_mulrev')
    ->getTableMapping();

  // Ensure that the tables for the new field are created.
  $this
    ->applyEntityUpdates('entity_test_mulrev');
}