You are here

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

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

Tests access to Project Management settings pages.

File

./pm.test, line 51
Test definitions for Project Management.

Class

PMTestCase
Define a test case for Project Management.

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".'));
}