You are here

public function AckMenuAccessTest::setUp in Access Control Kit 7

Overrides DrupalWebTestCase::setUp().

Overrides DrupalWebTestCase::setUp

File

ack_menu/ack_menu.test, line 76
Tests for the ACK menu module.

Class

AckMenuAccessTest
Tests the menu access functions.

Code

public function setUp() {
  parent::setUp(array(
    'ack_menu',
  ));

  // Create and log in our scheme menu admin.
  $this->ackAdmin = $this
    ->drupalCreateUser(array(
    'administer access schemes',
    'administer access grants',
    'administer ack_menu',
    'create article content',
    'edit own article content',
  ));
  $this
    ->drupalLogin($this->ackAdmin);

  // Create the test role.
  $rid = $this
    ->drupalCreateRole(array(
    'ack manage menu links',
    'create article content',
    'edit own article content',
  ));
  $this->ackRole = user_role_load($rid);

  // Create a user account for use in access grants.
  $this->ackUser = $this
    ->drupalCreateUser(array(
    'access content',
  ));

  // Add the user to the test role.
  db_insert('users_roles')
    ->fields(array(
    'uid' => $this->ackUser->uid,
    'rid' => $this->ackRole->rid,
  ))
    ->execute();
  $pass_raw = $this->ackUser->pass_raw;
  $this->ackUser = user_load($this->ackUser->uid, TRUE);
  $this->ackUser->pass_raw = $pass_raw;

  // Create a user with no menu access.
  $this->noAccessUser = $this
    ->drupalCreateUser(array(
    'access content',
    'create article content',
    'edit own article content',
  ));

  // Create a menu administrator.
  $this->menuAdmin = $this
    ->drupalCreateUser(array(
    'access content',
    'administer menu',
    'administer permissions',
    'create article content',
    'edit own article content',
  ));
}