function ContactSitewideTest::submitContact

Same name in other branches
  1. 8.9.x core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::submitContact()
  2. 10 core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::submitContact()
  3. 11.x 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 584

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->drupalGet('contact');
        $this->submitForm($edit, 'Send message');
    }
    else {
        $this->drupalGet('contact/' . $id);
        $this->submitForm($edit, 'Send message');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.