function ContactSitewideTest::deleteContactForms
Same name in other branches
- 8.9.x core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::deleteContactForms()
- 10 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 603
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), new FormattableMarkup('Form %contact_form not found', [
'%contact_form' => $contact_form->label(),
]));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.