You are here

protected function ContactPersonalTest::submitPersonalContact in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/contact/src/Tests/ContactPersonalTest.php \Drupal\contact\Tests\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/src/Tests/ContactPersonalTest.php
Tests the personal contact form flood protection.
ContactPersonalTest::testSendPersonalContactMessage in core/modules/contact/src/Tests/ContactPersonalTest.php
Tests that mails for contact messages are correctly sent.

File

core/modules/contact/src/Tests/ContactPersonalTest.php, line 319
Contains \Drupal\contact\Tests\ContactPersonalTest.

Class

ContactPersonalTest
Tests personal contact form functionality.

Namespace

Drupal\contact\Tests

Code

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