function FieldableEntityDefinitionUpdateTest::assertTranslatable
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\FieldableEntityDefinitionUpdateTest::assertTranslatable()
- 10 core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\FieldableEntityDefinitionUpdateTest::assertTranslatable()
- 11.x core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php \Drupal\KernelTests\Core\Entity\FieldableEntityDefinitionUpdateTest::assertTranslatable()
Asserts the translatable characteristics of an entity type.
@internal
2 calls to FieldableEntityDefinitionUpdateTest::assertTranslatable()
- FieldableEntityDefinitionUpdateTest::assertEntityTypeSchema in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ FieldableEntityDefinitionUpdateTest.php - Asserts revisionable and/or translatable characteristics of an entity type.
- FieldableEntityDefinitionUpdateTest::assertRevisionableAndTranslatable in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ FieldableEntityDefinitionUpdateTest.php - Asserts the revisionable / translatable characteristics of an entity type.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ FieldableEntityDefinitionUpdateTest.php, line 536
Class
- FieldableEntityDefinitionUpdateTest
- Tests EntityDefinitionUpdateManager's fieldable entity update functionality.
Namespace
Drupal\KernelTests\Core\EntityCode
protected function assertTranslatable() : void {
/** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */
$entity_type = $this->entityDefinitionUpdateManager
->getEntityType($this->entityTypeId);
$this->assertTrue($entity_type->isTranslatable());
// Check that the required field definitions of a translatable entity type
// exists and are stored in the correct tables.
$langcode_key = $entity_type->getKey('langcode');
$default_langcode_key = $entity_type->getKey('default_langcode');
$langcode_field = $this->entityDefinitionUpdateManager
->getFieldStorageDefinition($langcode_key, $entity_type->id());
$default_langcode_field = $this->entityDefinitionUpdateManager
->getFieldStorageDefinition($default_langcode_key, $entity_type->id());
$this->assertNotNull($langcode_field);
$this->assertNotNull($default_langcode_field);
$database_schema = $this->database
->schema();
$base_table = $entity_type->getBaseTable();
$data_table = $entity_type->getDataTable();
$this->assertTrue($database_schema->tableExists($data_table));
$this->assertTrue($database_schema->fieldExists($base_table, $langcode_key));
$this->assertTrue($database_schema->fieldExists($data_table, $langcode_key));
$this->assertFalse($database_schema->fieldExists($base_table, $default_langcode_key));
$this->assertTrue($database_schema->fieldExists($data_table, $default_langcode_key));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.