You are here

function PrivatemsgTestCase::testPreview in Privatemsg 6

Same name and namespace in other branches
  1. 6.2 privatemsg.test \PrivatemsgTestCase::testPreview()
  2. 7.2 privatemsg.test \PrivatemsgTestCase::testPreview()
  3. 7 privatemsg.test \PrivatemsgTestCase::testPreview()

Test preview functionality.

File

./privatemsg.test, line 562
Test file for privatemsg.module

Class

PrivatemsgTestCase
@file Test file for privatemsg.module

Code

function testPreview() {
  $user = $this
    ->drupalCreateUser(array(
    'read privatemsg',
    'write privatemsg',
  ));
  $message = array(
    'recipient' => $user->name,
    'subject' => $this
      ->randomName(),
    'body' => $this
      ->randomName(50),
  );
  $this
    ->drupalLogin($user);
  $this
    ->drupalPost('messages/new', $message, t('Preview message'));
  $this
    ->assertTitle(t('Write new message to @user', array(
    '@user' => $user->name,
  )) . ' | Drupal', t('Correct title is displayed.'));
  $this
    ->assertFieldByXPath("//div[@class='message-body']/p", $message['body'], t('Message body is previewed'));
}