You are here

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

Same name and namespace in other branches
  1. 8 pm.test \PMTestCase::testpmAccessSettings()
  2. 7.3 pm.test \PMTestCase::testpmAccessSettings()
  3. 7.2 pm.test \PMTestCase::testpmAccessSettings()

Tests access to Project Management settings pages.

File

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

Class

PMTestCase
@file Tests for the Project Management module

Code

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