You are here

public function PMTaskTestCase::testpmtaskAccess in Drupal PM (Project Management) 7

Same name and namespace in other branches
  1. 8 pmtask/pmtask.test \PMTaskTestCase::testpmtaskAccess()
  2. 7.3 pmtask/pmtask.test \PMTaskTestCase::testpmtaskAccess()
  3. 7.2 pmtask/pmtask.test \PMTaskTestCase::testpmtaskAccess()

Test of access controls on Task lists.

File

pmtask/pmtask.test, line 33
Test definitions for the PM Task module

Class

PMTaskTestCase
Class defining PM Task test cases.

Code

public function testpmtaskAccess() {
  $this
    ->drupalGet('pm/tasks');
  $this
    ->assertResponse(403, t('Make sure access is denied to Project Management Tasks list for anonymous user'));
  $basic_user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($basic_user);
  $this
    ->drupalGet('pm/tasks');
  $this
    ->assertResponse(403, t('Make sure access is denied to Project Management Tasks list for basic user'));
  $privileged_user = $this
    ->drupalCreateUser(array(
    'Project Management Task: access',
  ));
  $this
    ->drupalLogin($privileged_user);
  $this
    ->drupalGet('pm/tasks');
  $this
    ->assertText(t('Tasks'), t('Make sure the correct page has been displayed by checking that the title is "Tasks".'));
}