public function ContactStorageTestBase::submitContact in Contact Storage 8
Submits the contact form.
Parameters
string $name: The name of the sender.
string $mail: The email address of the sender.
string $subject: The subject of the message.
string $id: The form ID of the message.
string $message: The message body.
2 calls to ContactStorageTestBase::submitContact()
- BulkFormTest::setUp in tests/
src/ Functional/ BulkFormTest.php - ContactStorageTest::testContactStorage in tests/
src/ Functional/ ContactStorageTest.php - Tests contact messages submitted through contact form.
File
- tests/
src/ Functional/ ContactStorageTestBase.php, line 60
Class
- ContactStorageTestBase
- Defines a base-class for contact-storage tests.
Namespace
Drupal\Tests\contact_storage\FunctionalCode
public function submitContact($name, $mail, $subject, $id, $message) {
$edit = [];
$edit['name'] = $name;
$edit['mail'] = $mail;
$edit['subject[0][value]'] = $subject;
$edit['message[0][value]'] = $message;
if ($id == $this
->config('contact.settings')
->get('default_form')) {
$this
->drupalPostForm('contact', $edit, t('Send message'));
}
else {
$this
->drupalPostForm('contact/' . $id, $edit, t('Send message'));
}
}