You are here

public function PMProjectTestCase::testpmprojectAccess in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pmproject/pmproject.test \PMProjectTestCase::testpmprojectAccess()
  2. 7 pmproject/pmproject.test \PMProjectTestCase::testpmprojectAccess()
  3. 7.2 pmproject/pmproject.test \PMProjectTestCase::testpmprojectAccess()

Test case covering access of project list.

File

pmproject/pmproject.test, line 33
Test definitions for PM Project.

Class

PMProjectTestCase
Define a test case for PM Project.

Code

public function testpmprojectAccess() {

  // Anonymous user.
  $this
    ->drupalGet('pm/projects');
  $this
    ->assertResponse(403, 'Access is denied to the anonymous user.');

  // Authenticated user.
  $authenticated_user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($authenticated_user);
  $this
    ->drupalGet('pm/projects');
  $this
    ->assertResponse(403, 'Access is denied to the authenticated user.');

  // Privileged user.
  $privileged_user = $this
    ->drupalCreateUser(array(
    'Project Management Project: access',
  ));
  $this
    ->drupalLogin($privileged_user);
  $this
    ->drupalGet('pm/projects');
  $this
    ->assertText(t('Projects'), t('Access granted for the privileged user. Correct page has been confirmed by checking that the title is "Projects".'));
}