You are here

public function PasswordPolicyForcePasswordChangeTestCase::testPerms in Password Policy 7

Same name and namespace in other branches
  1. 6 tests/password_policy.test \PasswordPolicyForcePasswordChangeTestCase::testPerms()

Tests permissions.

File

tests/password_policy.test, line 382
Functional tests for Password policy module.

Class

PasswordPolicyForcePasswordChangeTestCase
Tests of forcing password changes.

Code

public function testPerms() {

  // No perms.
  $user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('admin/config/people/password_policy/password_change');
  $this
    ->assertResponse('403', 'Access should be denied.');
  $this
    ->drupalLogout();

  // With perms.
  $user = $this
    ->drupalCreateUser(array(
    'force password change',
  ));
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('admin/config/people/password_policy/password_change');
  $this
    ->assertResponse('200', 'Access should be granted.');
  $this
    ->drupalLogout();
}