You are here

public function PMIssueTestCase::testpmissueAccess in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pmissue/pmissue.test \PMIssueTestCase::testpmissueAccess()
  2. 7.2 pmissue/pmissue.test \PMIssueTestCase::testpmissueAccess()

Test of access controls on Issue lists.

File

pmissue/pmissue.test, line 34
Test definitions for PM Issue.

Class

PMIssueTestCase
Define a test case for PM Issue.

Code

public function testpmissueAccess() {

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

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

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