function PrivatemsgLinksTestCase::testMenuBlock in Privatemsg 7
Same name and namespace in other branches
- 6.2 privatemsg.test \PrivatemsgLinksTestCase::testMenuBlock()
- 6 privatemsg.test \PrivatemsgLinksTestCase::testMenuBlock()
- 7.2 privatemsg.test \PrivatemsgLinksTestCase::testMenuBlock()
Tests menu block.
File
- ./
privatemsg.test, line 1124 - Test file for privatemsg.module
Class
- PrivatemsgLinksTestCase
- Tests for fields 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(
'blocks[privatemsg_privatemsg-menu][region]' => 'sidebar_second',
);
$this
->drupalPost('admin/structure/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
->assertText(t('Private messages'), 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[value]' => $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'));
}