public function ContactSitewideTest::submitContact in Drupal 9
Same name and namespace in other branches
- 8 core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::submitContact()
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.
3 calls to ContactSitewideTest::submitContact()
- ContactSitewideTest::testAutoReply in core/modules/ contact/ tests/ src/ Functional/ ContactSitewideTest.php 
- Tests auto-reply on the site-wide contact form.
- ContactSitewideTest::testSiteWideContact in core/modules/ contact/ tests/ src/ Functional/ ContactSitewideTest.php 
- Tests configuration options and the site-wide contact form.
- ContactStorageTest::testContactStorage in core/modules/ contact/ tests/ src/ Functional/ ContactStorageTest.php 
- Tests configuration options and the site-wide contact form.
File
- core/modules/ contact/ tests/ src/ Functional/ ContactSitewideTest.php, line 574 
Class
- ContactSitewideTest
- Tests site-wide contact form functionality.
Namespace
Drupal\Tests\contact\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
      ->drupalGet('contact');
    $this
      ->submitForm($edit, 'Send message');
  }
  else {
    $this
      ->drupalGet('contact/' . $id);
    $this
      ->submitForm($edit, 'Send message');
  }
}