function ManageFieldsFunctionalTest::testTranslationDefaults
Same name in other branches
- 11.x core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::testTranslationDefaults()
Test translation defaults.
File
-
core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsFunctionalTest.php, line 393
Class
- ManageFieldsFunctionalTest
- Tests the Field UI "Manage fields" screen.
Namespace
Drupal\Tests\field_ui\FunctionalCode
public function testTranslationDefaults() : void {
$this->fieldUIAddNewField('admin/structure/types/manage/' . $this->contentType, $this->fieldNameInput, $this->fieldLabel);
$field_storage = FieldStorageConfig::loadByName('node', 'field_' . $this->fieldNameInput);
$this->assertTrue($field_storage->isTranslatable(), 'Field storage translatable.');
$field = FieldConfig::loadByName('node', $this->contentType, 'field_' . $this->fieldNameInput);
$this->assertFalse($field->isTranslatable(), 'Field instance should not be translatable by default.');
// Add a new field based on an existing field.
$this->drupalCreateContentType([
'type' => 'additional',
'name' => 'Additional type',
]);
$this->fieldUIAddExistingField("admin/structure/types/manage/additional", $this->fieldName, 'Additional type');
$field_storage = FieldStorageConfig::loadByName('node', 'field_' . $this->fieldNameInput);
$this->assertTrue($field_storage->isTranslatable(), 'Field storage translatable.');
$field = FieldConfig::loadByName('node', 'additional', 'field_' . $this->fieldNameInput);
$this->assertFalse($field->isTranslatable(), 'Field instance should not be translatable by default.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.