You are here

function AAR::createRoles in Auto Assign Role 6.2

Same name and namespace in other branches
  1. 6 tests/autoassignrole.test \AAR::createRoles()

Helper function to create the roles used for testing

1 call to AAR::createRoles()
AAR::setUp in tests/autoassignrole.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

File

tests/autoassignrole.test, line 18
Autoassignrole functionality tests.

Class

AAR
@file Autoassignrole functionality tests.

Code

function createRoles($count) {
  $roles = array();
  $x = 0;
  $permissions = array(
    'administer autoassignrole',
    'access comments',
    'access content',
    'post comments',
    'post comments without approval',
  );
  while ($x < $count) {
    $role = db_fetch_object(db_query("SELECT * FROM {role} WHERE rid = '%d'", $this
      ->drupalCreateRole($permissions)));
    $roles[$role->rid] = $role->name;
    $x++;
  }
  return $roles;
}