You are here

public function PMTestCase::testpmAttributesAccess in Drupal PM (Project Management) 7

Tests access to Project Management attributes pages.

File

./pm.test, line 70
Tests for the Project Management module

Class

PMTestCase
@file Tests for the Project Management module

Code

public function testpmAttributesAccess() {
  $this
    ->drupalGet('pm/attributes');
  $this
    ->assertResponse(403, t('Make sure access is denied to Project Management Attributes list for anonymous user'));
  $this
    ->drupalGet('pm/attributes/add');
  $this
    ->assertResponse(403, t('Make sure access is denied to Project Management Attributes form for anonymous user'));
  $basic_user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($basic_user);
  $this
    ->drupalGet('pm/attributes');
  $this
    ->assertResponse(403, t('Make sure access is denied to Project Management Attributes list for basic user'));
  $this
    ->drupalGet('pm/attributes/add');
  $this
    ->assertResponse(403, t('Make sure access is denied to Project Management Attributes form for basic user'));
  $privileged_user = $this
    ->drupalCreateUser(array(
    'Project Management: access administration pages',
  ));
  $this
    ->drupalLogin($privileged_user);
  $this
    ->drupalGet('pm/attributes');
  $this
    ->assertText(t('Attributes'), t('Make sure the correct page has been displayed by checking that the title is "Attributes".'));
  $this
    ->drupalGet('pm/attributes/add');
  $this
    ->assertText(t('Add a new attribute'), t('Make sure the correct page has been displayed by checking that the title is "Add a new attribute".'));
}