You are here

function ContactSitewideTest::submitContact in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/contact/src/Tests/ContactSitewideTest.php \Drupal\contact\Tests\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/src/Tests/ContactSitewideTest.php
Tests auto-reply on the site-wide contact form.
ContactSitewideTest::testSiteWideContact in core/modules/contact/src/Tests/ContactSitewideTest.php
Tests configuration options and the site-wide contact form.
ContactStorageTest::testContactStorage in core/modules/contact/src/Tests/ContactStorageTest.php
Tests configuration options and the site-wide contact form.

File

core/modules/contact/src/Tests/ContactSitewideTest.php, line 415
Contains \Drupal\contact\Tests\ContactSitewideTest.

Class

ContactSitewideTest
Tests site-wide contact form functionality.

Namespace

Drupal\contact\Tests

Code

function submitContact($name, $mail, $subject, $id, $message) {
  $edit = array();
  $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'));
  }
}