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