You are here

public function ManageFieldsFunctionalTest::testDeleteTaxonomyField in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::testDeleteTaxonomyField()
  2. 10 core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::testDeleteTaxonomyField()

Tests that deletion removes field storages and fields as expected for a term.

File

core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php, line 741

Class

ManageFieldsFunctionalTest
Tests the Field UI "Manage fields" screen.

Namespace

Drupal\Tests\field_ui\Functional

Code

public function testDeleteTaxonomyField() {

  // Create a new field.
  $bundle_path = 'admin/structure/taxonomy/manage/tags/overview';
  $this
    ->fieldUIAddNewField($bundle_path, $this->fieldNameInput, $this->fieldLabel);

  // Delete the field.
  $this
    ->fieldUIDeleteField($bundle_path, "taxonomy_term.tags.{$this->fieldName}", $this->fieldLabel, 'Tags');

  // Check that the field was deleted.
  $this
    ->assertNull(FieldConfig::loadByName('taxonomy_term', 'tags', $this->fieldName), 'Field was deleted.');

  // Check that the field storage was deleted too.
  $this
    ->assertNull(FieldStorageConfig::loadByName('taxonomy_term', $this->fieldName), 'Field storage was deleted.');
}