protected function ContentTranslationUntranslatableFieldsTest::setupTestFields in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_translation/tests/src/Functional/ContentTranslationUntranslatableFieldsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationUntranslatableFieldsTest::setupTestFields()
Creates the test fields.
Overrides ContentTranslationTestBase::setupTestFields
File
- core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationUntranslatableFieldsTest.php, line 50
Class
- ContentTranslationUntranslatableFieldsTest
- Tests the untranslatable fields behaviors.
Namespace
Drupal\Tests\content_translation\FunctionalCode
protected function setupTestFields() {
parent::setupTestFields();
$field_storage = FieldStorageConfig::create([
'field_name' => 'field_multilingual',
'type' => 'test_field',
'entity_type' => $this->entityTypeId,
'cardinality' => 1,
]);
$field_storage
->save();
FieldConfig::create([
'field_storage' => $field_storage,
'bundle' => $this->bundle,
'label' => 'Untranslatable-but-visible test field',
'translatable' => FALSE,
])
->save();
\Drupal::service('entity_display.repository')
->getFormDisplay($this->entityTypeId, $this->bundle, 'default')
->setComponent('field_multilingual', [
'type' => 'test_field_widget_multilingual',
])
->save();
}