You are here

public function FieldUiTestTrait::fieldUIDeleteField in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/field_ui/src/Tests/FieldUiTestTrait.php \Drupal\field_ui\Tests\FieldUiTestTrait::fieldUIDeleteField()

Deletes a field through the Field UI.

Parameters

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

string $field_name: The name of the field.

string $label: The label of the field.

string $bundle_label: The label of the bundle.

4 calls to FieldUiTestTrait::fieldUIDeleteField()
CommentNonNodeTest::testCommentFunctionality in core/modules/comment/src/Tests/CommentNonNodeTest.php
Tests anonymous comment functionality.
FieldUIDeleteTest::testDeleteField in core/modules/field_ui/src/Tests/FieldUIDeleteTest.php
Tests that deletion removes field storages and fields as expected.
ManageFieldsTest::testDeleteField in core/modules/field_ui/src/Tests/ManageFieldsTest.php
Tests that deletion removes field storages and fields as expected.
ManageFieldsTest::testDeleteTaxonomyField in core/modules/field_ui/src/Tests/ManageFieldsTest.php
Tests that deletion removes field storages and fields as expected for a term.

File

core/modules/field_ui/src/Tests/FieldUiTestTrait.php, line 116
Contains \Drupal\field_ui\Tests\FieldUiTestTrait.

Class

FieldUiTestTrait
Provides common functionality for the Field UI test classes.

Namespace

Drupal\field_ui\Tests

Code

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

  // Test Breadcrumbs.
  $this
    ->assertLink($label, 0, 'Field label is correct in the breadcrumb of the field delete page.');

  // Submit confirmation form.
  $this
    ->drupalPostForm(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.');
}