function PrivatemsgLinksTestCase::testMenuBlock in Privatemsg 6
Same name and namespace in other branches
- 6.2 privatemsg.test \PrivatemsgLinksTestCase::testMenuBlock()
- 7.2 privatemsg.test \PrivatemsgLinksTestCase::testMenuBlock()
- 7 privatemsg.test \PrivatemsgLinksTestCase::testMenuBlock()
Tests menu block.
File
- ./
privatemsg.test, line 604 - Test file for privatemsg.module
Class
- PrivatemsgLinksTestCase
- Tests for node, blocks and profile integration.
Code
function testMenuBlock() {
$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(
'privatemsg_privatemsg-menu[region]' => 'right',
);
$this
->drupalPost('admin/build/block', $blocks, t('Save blocks'));
// Disable secondary menu.
/* @todo: Not yet possible because simpletest needs a log out link to verify that the user is logged in.
$menu_settings = array(
'menu_secondary_links_source' => '',
);
$this->drupalPost('admin/structure/menu/settings', $menu_settings, t('Save configuration'));
*
*/
$this
->drupalGet('');
$this
->assertRaw('<h2>Private messages</h2>', t('Privatemsg menu block title displayed.'));
$this
->assertText('Write new message', t('Write new message link displayed.'));
$message = array(
'recipient' => $user->name,
'subject' => $this
->randomName(),
'body' => $this
->randomName(50),
);
$this
->drupalPost('messages/new', $message, t('Send message'));
$this
->drupalLogin($user);
$this
->assertNoText(t('Write new message'), t('Write new message link not displayed.'));
$this
->assertNoUniqueText(t('Messages (1 new)'), t('Messages link including new message information displayed'));
}