You are here

public function DefaultTableMappingIntegrationTest::testGetFieldTableName in Drupal 8

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

Tests DefaultTableMapping::getFieldTableName().

@covers ::getFieldTableName

File

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

Class

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

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testGetFieldTableName() {

  // Test the field table name for a single-valued base field, which is stored
  // in the entity's base table.
  $expected = 'entity_test_mulrev';
  $this
    ->assertEquals($this->tableMapping
    ->getFieldTableName('uuid'), $expected);

  // Test the field table name for a translatable and revisionable base field,
  // which is stored in the entity's data table.
  $expected = 'entity_test_mulrev_property_data';
  $this
    ->assertEquals($this->tableMapping
    ->getFieldTableName('name'), $expected);

  // Test the field table name for a multi-valued base field, which is stored
  // in a dedicated table.
  $expected = 'entity_test_mulrev__multivalued_base_field';
  $this
    ->assertEquals($this->tableMapping
    ->getFieldTableName('multivalued_base_field'), $expected);
}