public function SqlContentEntityStorageTest::testGetTableMappingSimpleWithFields in Drupal 9
Same name and namespace in other branches
- 8 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 510 - Contains \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest.
Class
- SqlContentEntityStorageTest
- @coversDefaultClass \Drupal\Core\Entity\Sql\SqlContentEntityStorage @group Entity
Namespace
Drupal\Tests\Core\Entity\SqlCode
public function testGetTableMappingSimpleWithFields(array $entity_keys) {
$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'));
}