You are here

function PrivatemsgLinksTestCase::testNewBlock in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 privatemsg.test \PrivatemsgLinksTestCase::testNewBlock()
  2. 6 privatemsg.test \PrivatemsgLinksTestCase::testNewBlock()
  3. 7.2 privatemsg.test \PrivatemsgLinksTestCase::testNewBlock()

Tests menu block.

File

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

Class

PrivatemsgLinksTestCase
Tests for fields integration.

Code

function testNewBlock() {
  $admin = $this
    ->drupalCreateUser(array(
    'read privatemsg',
    'write privatemsg',
    'administer privatemsg settings',
    'administer blocks',
    'administer menu',
  ));
  $user = $this
    ->drupalCreateUser(array(
    'read privatemsg',
  ));

  // Enable block.
  $this
    ->drupalLogin($admin);
  $blocks = array(
    'blocks[privatemsg_privatemsg-new][region]' => 'sidebar_second',
  );
  $this
    ->drupalPost('admin/structure/block', $blocks, t('Save blocks'));
  $this
    ->drupalGet('');
  $this
    ->assertNoText(t('New message'), t('Privatemsg new block title not displayed.'));
  $message = array(
    'recipient' => $user->name,
    'subject' => $this
      ->randomName(),
    'body[value]' => $this
      ->randomName(50),
  );
  $this
    ->drupalPost('messages/new', $message, t('Send message'));
  $this
    ->drupalLogin($user);
  $this
    ->assertText(t('New message'), t('Privatemsg new block title displayed.'));
  $this
    ->assertText(t('You have a new message! Click here to read it.'), t('New message indication displayed.'));
}