function DefaultTableMappingIntegrationTest::testGetTableNames
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php \Drupal\KernelTests\Core\Entity\DefaultTableMappingIntegrationTest::testGetTableNames()
- 8.9.x core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php \Drupal\KernelTests\Core\Entity\DefaultTableMappingIntegrationTest::testGetTableNames()
- 11.x core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php \Drupal\KernelTests\Core\Entity\DefaultTableMappingIntegrationTest::testGetTableNames()
Tests DefaultTableMapping::getTableNames().
@covers ::getTableNames
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ DefaultTableMappingIntegrationTest.php, line 140
Class
- DefaultTableMappingIntegrationTest
- Tests the default table mapping class for content entities stored in SQL.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testGetTableNames() : void {
$storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_mulrev');
$dedicated_data_table = $this->tableMapping
->getDedicatedDataTableName($storage_definitions['multivalued_base_field']);
$dedicated_revision_table = $this->tableMapping
->getDedicatedRevisionTableName($storage_definitions['multivalued_base_field']);
// Check that both the data and the revision tables exist for a multi-valued
// base field.
$database_schema = \Drupal::database()->schema();
$this->assertTrue($database_schema->tableExists($dedicated_data_table));
$this->assertTrue($database_schema->tableExists($dedicated_revision_table));
// Check that the table mapping contains both the data and the revision
// tables exist for a multi-valued base field.
$expected = [
'entity_test_mulrev',
'entity_test_mulrev_property_data',
'entity_test_mulrev_revision',
'entity_test_mulrev_property_revision',
$dedicated_data_table,
$dedicated_revision_table,
];
$this->assertEquals($expected, $this->tableMapping
->getTableNames());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.