You are here

function PrivatemsgGroupsTestCase::testSendMessagetoGroupAPI in Privatemsg 7.2

Test sending message to a group using privatemsg_new_thread API method.

File

privatemsg_groups/privatemsg_groups.test, line 54
This file contains tests for the privatemsg groups module

Class

PrivatemsgGroupsTestCase
Test cases for the privatemsg_groups module.

Code

function testSendMessagetoGroupAPI() {
  $recipient = clone $this->group1;
  $recipient->recipient = $this->group1->nid;
  $recipient->type = _privatemsg_groups_get_group_recipient_type('node');
  privatemsg_new_thread(array(
    $recipient,
  ), $subject = $this
    ->randomName(10), $body = $this
    ->randomName(50), array(
    'author' => $this->group1_manager,
  ));
  $this
    ->drupalLogin($this->user1);
  $this
    ->drupalGet('messages');
  $this
    ->assertRaw($subject . '</a> <span class="marker">new</span>', t('Message is displayed as new'));
  $this
    ->clickLink($subject);
  $this
    ->assertText($body, t('Thread starter body displayed.'));
}