function ManageFieldsLifecycleTest::updateField
Same name in other branches
- 11.x core/modules/field_ui/tests/src/Functional/ManageFieldsLifecycleTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsLifecycleTest::updateField()
Tests editing an existing field.
1 call to ManageFieldsLifecycleTest::updateField()
- ManageFieldsLifecycleTest::testCRUDFields in core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsLifecycleTest.php - Runs the field CRUD tests.
File
-
core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsLifecycleTest.php, line 92
Class
- ManageFieldsLifecycleTest
- Tests the Field UI "Manage fields" screen.
Namespace
Drupal\Tests\field_ui\FunctionalCode
protected function updateField() {
$field_id = 'node.' . $this->contentType . '.' . $this->fieldName;
// Go to the field edit page.
$this->drupalGet('admin/structure/types/manage/' . $this->contentType . '/fields/' . $field_id);
$this->assertSession()
->assertEscaped($this->fieldLabel);
// Populate the field settings with new settings.
$string = 'updated dummy test string';
$edit = [
'settings[test_field_setting]' => $string,
'field_storage[subform][settings][test_field_storage_setting]' => $string,
];
$this->assertSession()
->pageTextContains('Default value');
$this->submitForm($edit, 'Save settings');
// Assert the field settings are correct.
$this->assertFieldSettings($this->contentType, $this->fieldName, $string);
// Assert redirection back to the "manage fields" page.
$this->assertSession()
->addressEquals('admin/structure/types/manage/' . $this->contentType . '/fields');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.