You are here

public function PasswordPolicyForcePasswordChangeTestCase::testPerms in Password Policy 6

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

File

tests/password_policy.test, line 278
Unit tests for Password policy module.

Class

PasswordPolicyForcePasswordChangeTestCase

Code

public function testPerms() {

  // no perms
  $user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('admin/settings/password_policy/password_change');
  $this
    ->assertResponse('403', t('Acces should be denied.'));
  $this
    ->drupalLogout();

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