You are here

function PrivatemsgLinksTestCase::testNewBlock in Privatemsg 7.2

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

Tests menu block.

File

./privatemsg.test, line 1154
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('Unread message'), t('Privatemsg unread message 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('Unread message'), t('Privatemsg unread message block title displayed.'));
  $this
    ->assertText(t('You have an unread message! Click here to read it.'), t('Unread message indication displayed.'));
}