function PrivatemsgTestCase::testPrivatemsgWritePrivatemsgPermission in Privatemsg 7.2
Same name and namespace in other branches
- 6.2 privatemsg.test \PrivatemsgTestCase::testPrivatemsgWritePrivatemsgPermission()
- 6 privatemsg.test \PrivatemsgTestCase::testPrivatemsgWritePrivatemsgPermission()
- 7 privatemsg.test \PrivatemsgTestCase::testPrivatemsgWritePrivatemsgPermission()
Test user access to /messages/new Create user with no 'write privatemsg' permission. Try to access Write New Message page and see if it gives access denied error Create user with 'write privatemsg' permission. Try to access Write New Message page and see if it gives allows access
File
- ./
privatemsg.test, line 119 - Test file for privatemsg.module
Class
Code
function testPrivatemsgWritePrivatemsgPermission() {
$user_no_write_msg = $this
->drupalCreateUser();
// set up user with default permissions (meaning: no read privatemsg permission
$this
->drupalLogin($user_no_write_msg);
$this
->drupalGet('messages/new');
$this
->assertResponse(403, t('HTTP Response 403: Access to Write New Message page was blocked to user without "<em>write privatemsg</em>" permission'));
$user_write_msg = $this
->drupalCreateUser(array(
'write privatemsg',
));
// set up user with write privatemsg permissions
$this
->drupalLogin($user_write_msg);
$this
->drupalGet('messages/new');
$this
->assertResponse(200, t('HTTP Response 200: Access to Write New Message page was authorized to user with "<em>write privatemsg</em>" permission'));
}