function ContactSitewideTest::deleteContactForms
Same name in other branches
- 9 core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::deleteContactForms()
- 8.9.x core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::deleteContactForms()
- 11.x core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::deleteContactForms()
Deletes all forms.
1 call to ContactSitewideTest::deleteContactForms()
- ContactSitewideTest::testSiteWideContact in core/
modules/ contact/ tests/ src/ Functional/ ContactSitewideTest.php - Tests configuration options and the site-wide contact form.
File
-
core/
modules/ contact/ tests/ src/ Functional/ ContactSitewideTest.php, line 606
Class
- ContactSitewideTest
- Tests site-wide contact form functionality.
Namespace
Drupal\Tests\contact\FunctionalCode
public function deleteContactForms() {
$contact_forms = ContactForm::loadMultiple();
foreach ($contact_forms as $id => $contact_form) {
if ($id == 'personal') {
// Personal form could not be deleted.
$this->drupalGet("admin/structure/contact/manage/{$id}/delete");
$this->assertSession()
->statusCodeEquals(403);
}
else {
$this->drupalGet("admin/structure/contact/manage/{$id}/delete");
$this->submitForm([], 'Delete');
$this->assertSession()
->pageTextContains("The contact form {$contact_form->label()} has been deleted.");
$this->assertNull(ContactForm::load($id), "Form {$contact_form->label()} not found");
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.