1.20.x field_ui.test FieldUIManageFieldsTestCase::updateField()

Tests editing an existing field.

File

modules/field_ui/tests/field_ui.test, line 261
Tests for field_ui.module.

Class

FieldUIManageFieldsTestCase
Tests the functionality of the 'Manage fields' screen.

Code

function updateField() {
  // Go to the field edit page.
  $this->backdropGet('admin/structure/types/manage/' . $this->hyphen_type . '/fields/' . $this->field_name);

  // Populate the field settings with new settings.
  $string = 'updated dummy test string';
  $edit = array(
    'field[settings][test_field_setting]' => $string,
    'instance[settings][test_instance_setting]' => $string,
    'instance[widget][settings][test_widget_setting]' => $string,
  );
  $this->backdropPost(NULL, $edit, t('Save settings'));

  // Assert the field settings are correct.
  $this->assertFieldSettings($this->type, $this->field_name, $string);

  // Assert redirection back to the "manage fields" page.
  $this->assertText(t('Saved @label configuration.', array('@label' => $this->field_label)), 'Redirected to "Manage fields" page.');
}