function FieldUIManageFieldsTestCase::updateField

Tests editing an existing field.

1 call to FieldUIManageFieldsTestCase::updateField()
FieldUIManageFieldsTestCase::testCRUDFields in modules/field_ui/field_ui.test
Runs the field CRUD tests.

File

modules/field_ui/field_ui.test, line 223

Class

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

Code

function updateField() {
  // Go to the field edit page.
  $this->drupalGet('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->drupalPost(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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.