You are here

protected function ContactStoragePersonalTest::submitPersonalContact in Contact Storage 8

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.

1 call to ContactStoragePersonalTest::submitPersonalContact()
ContactStoragePersonalTest::testSendPersonalContactMessage in tests/src/Functional/ContactStoragePersonalTest.php
Tests that mails for contact messages are correctly sent.

File

tests/src/Functional/ContactStoragePersonalTest.php, line 123

Class

ContactStoragePersonalTest
Tests personal contact form functionality.

Namespace

Drupal\Tests\contact_storage\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;
}