function DefaultTableMappingIntegrationTest::testGetAllFieldTableNames

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php \Drupal\KernelTests\Core\Entity\DefaultTableMappingIntegrationTest::testGetAllFieldTableNames()
  2. 11.x core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php \Drupal\KernelTests\Core\Entity\DefaultTableMappingIntegrationTest::testGetAllFieldTableNames()

@covers ::getAllFieldTableNames

File

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

Class

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

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testGetAllFieldTableNames() : void {
    // Check a field that is stored in all the shared tables.
    $expected = [
        'entity_test_mulrev',
        'entity_test_mulrev_property_data',
        'entity_test_mulrev_revision',
        'entity_test_mulrev_property_revision',
    ];
    $this->assertEquals($expected, $this->tableMapping
        ->getAllFieldTableNames('id'));
    // Check a field that is stored only in the base table.
    $expected = [
        'entity_test_mulrev',
    ];
    $this->assertEquals($expected, $this->tableMapping
        ->getAllFieldTableNames('uuid'));
    // Check a field that is stored only in the revision table.
    $expected = [
        'entity_test_mulrev_revision',
    ];
    $this->assertEquals($expected, $this->tableMapping
        ->getAllFieldTableNames('revision_default'));
    // Check a field that field that is stored in the data and revision data
    // tables.
    $expected = [
        'entity_test_mulrev_property_data',
        'entity_test_mulrev_property_revision',
    ];
    $this->assertEquals($expected, $this->tableMapping
        ->getAllFieldTableNames('name'));
    // Check a field that is stored in dedicated data and revision data tables.
    $expected = [
        'entity_test_mulrev__multivalued_base_field',
        'entity_test_mulrev_r__f86e511394',
    ];
    $this->assertEquals($expected, $this->tableMapping
        ->getAllFieldTableNames('multivalued_base_field'));
}

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