You are here

protected function UserProtectWebTestBase::createBypassRule in User protect 7

Creates a bypass rule.

Parameters

int $uid: The ID of the user for which the bypass counts.

array $protections: The protections that the user my bypass.

1 call to UserProtectWebTestBase::createBypassRule()
UserProtectBypassWebTest::doCheckBypass in tests/UserProtectBypassWebTest.test
Tests if bypassing a certain protection is respected.

File

tests/UserProtectWebTestBase.test, line 145
Contains \UserProtectWebTestBase.

Class

UserProtectWebTestBase
Base class for User protect web tests.

Code

protected function createBypassRule($uid, array $protections = array()) {

  // Add default values.
  $protections += array(
    'up_name' => 0,
    'up_mail' => 0,
    'up_pass' => 0,
    'up_status' => 0,
    'up_roles' => 0,
    'up_openid' => 0,
    'up_cancel' => 0,
    'up_edit' => 0,
  );
  $protections['uid'] = $uid;
  $protections['up_type'] = 'admin';

  // Create bypass rule.
  drupal_write_record('userprotect', $protections);
}