function FieldUITestCase::fieldUIDeleteField

Deletes a field instance through the Field UI.

Parameters

$bundle_path: Admin path of the bundle that the field instance is to be deleted from.

$field_name: The name of the field.

$label: The label of the field.

$bundle_label: The label of the bundle.

1 call to FieldUITestCase::fieldUIDeleteField()
FieldUIManageFieldsTestCase::testDeleteField in modules/field_ui/field_ui.test
Tests that deletion removes fields and instances as expected.

File

modules/field_ui/field_ui.test, line 121

Class

FieldUITestCase
Provides common functionality for the Field UI test classes.

Code

function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_label) {
    // Display confirmation form.
    $this->drupalGet("{$bundle_path}/fields/{$field_name}/delete");
    $this->assertRaw(t('Are you sure you want to delete the field %label', array(
        '%label' => $label,
    )), 'Delete confirmation was found.');
    // Submit confirmation form.
    $this->drupalPost(NULL, array(), t('Delete'));
    $this->assertRaw(t('The field %label has been deleted from the %type content type.', array(
        '%label' => $label,
        '%type' => $bundle_label,
    )), 'Delete message was found.');
    // Check that the field does not appear in the overview form.
    $this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, 'Field does not appear in the overview page.');
}

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