You are here

public function ContactSitewideTest::submitContact in Drupal 8

Same name and namespace in other branches
  1. 9 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 558

Class

ContactSitewideTest
Tests site-wide contact form functionality.

Namespace

Drupal\Tests\contact\Functional

Code

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'));
  }
}