function FieldUiTestBase::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.

2 calls to FieldUiTestBase::fieldUIDeleteField()
ManageFieldsTest::testDeleteField in drupal/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
Tests that deletion removes fields and instances as expected.
ManageFieldsTest::testDeleteTaxonomyField in drupal/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
Tests that deletion removes fields and instances as expected for a term.

File

drupal/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php, line 134
Contains \Drupal\field_ui\Tests\FieldUiTestBase.

Class

FieldUiTestBase
Provides common functionality for the Field UI test classes.

Namespace

Drupal\field_ui\Tests

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.');
}