function FieldSqlStorageTest::setUp
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php \Drupal\KernelTests\Core\Entity\FieldSqlStorageTest::setUp()
- 8.9.x core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php \Drupal\KernelTests\Core\Entity\FieldSqlStorageTest::setUp()
- 10 core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php \Drupal\KernelTests\Core\Entity\FieldSqlStorageTest::setUp()
Overrides EntityKernelTestBase::setUp
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ FieldSqlStorageTest.php, line 79
Class
- FieldSqlStorageTest
- Tests Field SQL Storage .
Namespace
Drupal\KernelTests\Core\EntityCode
protected function setUp() : void {
parent::setUp();
$this->installEntitySchema('entity_test_rev');
$entity_type = 'entity_test_rev';
$this->fieldName = $this->randomMachineName();
$this->fieldCardinality = 4;
$this->fieldStorage = FieldStorageConfig::create([
'field_name' => $this->fieldName,
'entity_type' => $entity_type,
'type' => 'test_field',
'cardinality' => $this->fieldCardinality,
]);
$this->fieldStorage
->save();
$this->field = FieldConfig::create([
'field_storage' => $this->fieldStorage,
'bundle' => $entity_type,
]);
$this->field
->save();
/** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
$table_mapping = \Drupal::entityTypeManager()->getStorage($entity_type)
->getTableMapping();
$this->tableMapping = $table_mapping;
$this->table = $table_mapping->getDedicatedDataTableName($this->fieldStorage);
$this->revisionTable = $table_mapping->getDedicatedRevisionTableName($this->fieldStorage);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.