function DefaultTableMappingTest::testGetDedicatedTableName

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::testGetDedicatedTableName()
  2. 10 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::testGetDedicatedTableName()
  3. 11.x core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::testGetDedicatedTableName()

@covers ::getDedicatedDataTableName @covers ::getDedicatedRevisionTableName

@dataProvider providerTestGetDedicatedTableName

File

core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php, line 458

Class

DefaultTableMappingTest
@coversDefaultClass \Drupal\Core\Entity\Sql\DefaultTableMapping @group Entity

Namespace

Drupal\Tests\Core\Entity\Sql

Code

public function testGetDedicatedTableName($info, $expected_data_table, $expected_revision_table) {
    $entity_type_id = $info['entity_type_id'];
    $field_name = $info['field_name'];
    $definition = $this->setUpDefinition($field_name, []);
    $definition->expects($this->any())
        ->method('getTargetEntityTypeId')
        ->willReturn($entity_type_id);
    $definition->expects($this->any())
        ->method('getUniqueStorageIdentifier')
        ->willReturn($entity_type_id . '-' . $field_name);
    $this->entityType
        ->expects($this->any())
        ->method('getBaseTable')
        ->willReturn($info['entity_type_id']);
    $this->entityType
        ->expects($this->any())
        ->method('isTranslatable')
        ->willReturn(FALSE);
    $this->entityType
        ->expects($this->any())
        ->method('isRevisionable')
        ->willReturn(FALSE);
    $table_mapping = new TestDefaultTableMapping($this->entityType, [], $info['prefix']);
    $this->assertSame($expected_data_table, $table_mapping->getDedicatedDataTableName($definition));
    $this->assertSame($expected_revision_table, $table_mapping->getDedicatedRevisionTableName($definition));
}

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