You are here

protected function ContactPersonalTest::submitPersonalContact in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/contact/tests/src/Functional/ContactPersonalTest.php \Drupal\Tests\contact\Functional\ContactPersonalTest::submitPersonalContact()

Fills out a user's personal contact form and submits it.

Parameters

\Drupal\Core\Session\AccountInterface $account: A user object of the user being contacted.

array $message: (optional) An array with the form fields being used. Defaults to an empty array.

Return value

array An array with the form fields being used.

2 calls to ContactPersonalTest::submitPersonalContact()
ContactPersonalTest::testPersonalContactFlood in core/modules/contact/tests/src/Functional/ContactPersonalTest.php
Tests the personal contact form flood protection.
ContactPersonalTest::testSendPersonalContactMessage in core/modules/contact/tests/src/Functional/ContactPersonalTest.php
Tests that mails for contact messages are correctly sent.

File

core/modules/contact/tests/src/Functional/ContactPersonalTest.php, line 342

Class

ContactPersonalTest
Tests personal contact form functionality.

Namespace

Drupal\Tests\contact\Functional

Code

protected function submitPersonalContact(AccountInterface $account, array $message = []) {
  $message += [
    'subject[0][value]' => $this
      ->randomMachineName(16) . '< " =+ >',
    'message[0][value]' => $this
      ->randomMachineName(64) . '< " =+ >',
  ];
  $this
    ->drupalPostForm('user/' . $account
    ->id() . '/contact', $message, t('Send message'));
  return $message;
}