function SqlContentEntityStorageTest::testGetTableMappingSimpleWithFields
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testGetTableMappingSimpleWithFields()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testGetTableMappingSimpleWithFields()
- 11.x core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testGetTableMappingSimpleWithFields()
Tests getTableMapping() with a simple entity type with some base fields.
@covers ::__construct @covers ::getTableMapping
@dataProvider providerTestGetTableMappingSimple
Parameters
string[] $entity_keys: A map of entity keys to use for the mocked entity type.
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ Sql/ SqlContentEntityStorageTest.php, line 511
Class
- SqlContentEntityStorageTest
- @coversDefaultClass \Drupal\Core\Entity\Sql\SqlContentEntityStorage @group Entity
Namespace
Drupal\Tests\Core\Entity\SqlCode
public function testGetTableMappingSimpleWithFields(array $entity_keys) : void {
$base_field_names = [
'title',
'description',
'owner',
];
$field_names = array_merge(array_values(array_filter($entity_keys)), $base_field_names);
$this->fieldDefinitions = $this->mockFieldDefinitions($field_names);
$this->setUpEntityStorage();
$mapping = $this->entityStorage
->getTableMapping();
$this->assertEquals([
'entity_test',
], $mapping->getTableNames());
$this->assertEquals($field_names, $mapping->getFieldNames('entity_test'));
$this->assertEquals([], $mapping->getExtraColumns('entity_test'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.