function FieldUiTestTrait::fieldUIDeleteField
Same name in other branches
- 8.9.x core/modules/field_ui/src/Tests/FieldUiTestTrait.php \Drupal\field_ui\Tests\FieldUiTestTrait::fieldUIDeleteField()
- 8.9.x core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php \Drupal\Tests\field_ui\Traits\FieldUiTestTrait::fieldUIDeleteField()
- 10 core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php \Drupal\Tests\field_ui\Traits\FieldUiTestTrait::fieldUIDeleteField()
- 11.x core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php \Drupal\Tests\field_ui\Traits\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/ tests/ src/ Functional/ CommentNonNodeTest.php - Tests anonymous comment functionality.
- FieldUIDeleteTest::testDeleteField in core/
modules/ field_ui/ tests/ src/ Functional/ FieldUIDeleteTest.php - Tests that deletion removes field storages and fields as expected.
- ManageFieldsFunctionalTest::testDeleteField in core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsFunctionalTest.php - Tests that deletion removes field storages and fields as expected.
- ManageFieldsFunctionalTest::testDeleteTaxonomyField in core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsFunctionalTest.php - Tests that deletion removes field storages and fields as expected for a term.
File
-
core/
modules/ field_ui/ tests/ src/ Traits/ FieldUiTestTrait.php, line 123
Class
- FieldUiTestTrait
- Provides common functionality for the Field UI test classes.
Namespace
Drupal\Tests\field_ui\TraitsCode
public function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_label) {
// Display confirmation form.
$this->drupalGet("{$bundle_path}/fields/{$field_name}/delete");
$this->assertSession()
->pageTextContains("Are you sure you want to delete the field {$label}");
// Test Breadcrumbs.
$this->assertSession()
->linkExists($label, 0, 'Field label is correct in the breadcrumb of the field delete page.');
// Submit confirmation form.
$this->submitForm([], 'Delete');
$this->assertSession()
->pageTextContains("The field {$label} has been deleted from the {$bundle_label} content type.");
// Check that the field does not appear in the overview form.
$xpath = $this->assertSession()
->buildXPathQuery('//table[@id="field-overview"]//span[@class="label-field" and text()= :label]', [
':label' => $label,
]);
$this->assertSession()
->elementNotExists('xpath', $xpath);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.