public function PMTaskTestCase::testpmtaskAccess in Drupal PM (Project Management) 7.3
Same name and namespace in other branches
- 8 pmtask/pmtask.test \PMTaskTestCase::testpmtaskAccess()
- 7 pmtask/pmtask.test \PMTaskTestCase::testpmtaskAccess()
- 7.2 pmtask/pmtask.test \PMTaskTestCase::testpmtaskAccess()
Test of access controls on Task lists.
File
- pmtask/
pmtask.test, line 34 - Test definitions for PM Task.
Class
- PMTaskTestCase
- Define a test case for PM Task.
Code
public function testpmtaskAccess() {
// Anonymous user.
$this
->drupalGet('pm/tasks');
$this
->assertResponse(403, 'Access is denied to the anonymous user.');
// Authenticated user.
$authenticated_user = $this
->drupalCreateUser();
$this
->drupalLogin($authenticated_user);
$this
->drupalGet('pm/tasks');
$this
->assertResponse(403, 'Access is denied to the authenticated user.');
// Privileged user.
$privileged_user = $this
->drupalCreateUser(array(
'Project Management Task: access',
));
$this
->drupalLogin($privileged_user);
$this
->drupalGet('pm/tasks');
$this
->assertText(t('Tasks'), t('Access granted for the privileged user. Correct page has been confirmed by checking that the title is "Tasks".'));
}