public function PasswordPolicyConditionsTestCase::testRoleCondition in Password Policy 7.2
Tests role condition.
File
- ./
password_policy.test, line 328 - Unit tests for Password policy module.
Class
- PasswordPolicyConditionsTestCase
- Test case to verify accuracy of each available policy condition.
Code
public function testRoleCondition() {
$rid = $this
->drupalCreateRole(array());
$config = array(
'role' => array(
'roles' => array(
$rid => 1,
),
),
);
$policy = $this
->createPolicy($config);
$this
->assertFalse($this
->matchPolicy($policy), 'Role condition fails with unprivileged account.', 'Condition');
// Add role to user in order to match the condition.
$this->account->roles[$rid] = 'test role';
$this
->assertTrue($this
->matchPolicy($policy), 'Role condition passes with privileged account.', 'Condition');
}