public function ManageFieldsFunctionalTest::updateField in Drupal 10
Same name and namespace in other branches
- 8 core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::updateField()
- 9 core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::updateField()
Tests editing an existing field.
File
- core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsFunctionalTest.php, line 220
Class
- ManageFieldsFunctionalTest
- Tests the Field UI "Manage fields" screen.
Namespace
Drupal\Tests\field_ui\FunctionalCode
public 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 . '/storage');
$this
->assertSession()
->assertEscaped($this->fieldLabel);
// Populate the field settings with new settings.
$string = 'updated dummy test string';
$edit = [
'settings[test_field_storage_setting]' => $string,
];
$this
->submitForm($edit, 'Save field settings');
// Go to the field edit page.
$this
->drupalGet('admin/structure/types/manage/' . $this->contentType . '/fields/' . $field_id);
$edit = [
'settings[test_field_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');
}