You are here

class ProtectedNodeBaseTestCase in Protected Node 1.0.x

Same name and namespace in other branches
  1. 7 tests/protected_node.test \ProtectedNodeBaseTestCase

This class adds the requirements for all protected_node test classes.

Hierarchy

Expanded class hierarchy of ProtectedNodeBaseTestCase

File

tests/protected_node.test, line 14
Base test class.

View source
class ProtectedNodeBaseTestCase extends DrupalWebTestCase {

  /**
   * Prepare users for protected node's tests.
   */
  public function setUp() {

    // See DrupalWebTestCase::setUp().
    // Install modules needed for this test. This could have been passed in as
    // either a single array argument or a variable number of string arguments.
    $modules = func_get_args();
    if (isset($modules[0]) && is_array($modules[0])) {
      $modules = $modules[0];
    }
    elseif (isset($modules[0]) && !is_array($modules[0])) {
      $modules = array(
        $modules[0],
      );
    }
    else {
      $modules = array();
    }
    $modules = array_merge(array(
      'protected_node',
    ), $modules);
    parent::setUp($modules);

    // Set the group.
    $this->group = 'Protected Node';

    // User with all needed permissions.
    $this->adminUser = $this
      ->drupalCreateUser(array(
      'access protected node password form',
      'edit any protected node password',
      'edit protected content',
      'administer site configuration',
      'administer nodes',
      'bypass node access',
      'administer content types',
      'administer paragraphs bundles',
    ));

    // User with access protected node permission.
    $this->normalAccessAllowedUser = $this
      ->drupalCreateUser(array(
      'access protected node password form',
    ));

    // User with access protected node permission.
    $this->bypassViewAccessAllowedUser = $this
      ->drupalCreateUser(array(
      'access protected node password form',
      'view protected content',
    ));

    // User with view published content permission.
    $this->normalNonAccessAllowedUser = $this
      ->drupalCreateUser(array(
      'access content',
    ));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ProtectedNodeBaseTestCase::setUp public function Prepare users for protected node's tests. 12