function DefaultTableMappingIntegrationTest::setUp

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php \Drupal\KernelTests\Core\Entity\DefaultTableMappingIntegrationTest::setUp()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php \Drupal\KernelTests\Core\Entity\DefaultTableMappingIntegrationTest::setUp()
  3. 11.x 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() {
    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');
}

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