You are here

function PrivatemsgRolesTestCase::testPermission in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 privatemsg_roles/privatemsg_roles.test \PrivatemsgRolesTestCase::testPermission()
  2. 7.2 privatemsg_roles/privatemsg_roles.test \PrivatemsgRolesTestCase::testPermission()

File

privatemsg_roles/privatemsg_roles.test, line 134
This file contains tests for the privatemsg roles module

Class

PrivatemsgRolesTestCase
Test cases for the privatemsg_roles module.

Code

function testPermission() {
  $user1 = $this
    ->drupalCreateUser(array(
    'read privatemsg',
    'write privatemsg',
  ));
  $user2 = $this
    ->drupalCreateUser(array(
    'read privatemsg',
    'write privatemsg',
  ));
  $this
    ->drupalLogin($user1);

  // Send a message to the role of user 1 and 2.
  $edit = array(
    'recipient' => $user2->roles[4] . '[role]',
    'subject' => $this
      ->randomName(10),
    'body[value]' => $this
      ->randomName(50),
  );
  $this
    ->drupalPost('messages/new', $edit, t('Send message'));
  $this
    ->assertText(t('You must include at least one valid recipient.'));
}