function ContactSitewideTest::deleteContactForms
Same name in other branches
- 9 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 575
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->drupalPostForm("admin/structure/contact/manage/{$id}/delete", [], t('Delete'));
$this->assertRaw(t('The contact form %label has been deleted.', [
'%label' => $contact_form->label(),
]));
$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.