public function DefaultTableMappingTest::testGetDedicatedTableName in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::testGetDedicatedTableName()
- 10 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 455
Class
- DefaultTableMappingTest
- @coversDefaultClass \Drupal\Core\Entity\Sql\DefaultTableMapping @group Entity
Namespace
Drupal\Tests\Core\Entity\SqlCode
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')
->will($this
->returnValue($entity_type_id));
$definition
->expects($this
->any())
->method('getUniqueStorageIdentifier')
->will($this
->returnValue($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));
}