function ManageFieldsTest::testDeleteTaxonomyField in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field_ui/src/Tests/ManageFieldsTest.php \Drupal\field_ui\Tests\ManageFieldsTest::testDeleteTaxonomyField()
Tests that deletion removes field storages and fields as expected for a term.
File
- core/
modules/ field_ui/ src/ Tests/ ManageFieldsTest.php, line 628 - Contains \Drupal\field_ui\Tests\ManageFieldsTest.
Class
- ManageFieldsTest
- Tests the Field UI "Manage fields" screen.
Namespace
Drupal\field_ui\TestsCode
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.');
}