AccessTestBase.php

Definition of Drupal\views\Tests\Uses\AccessTestBase.

Namespace

Drupal\views\Tests\User

File

drupal/core/modules/views/lib/Drupal/views/Tests/User/AccessTestBase.php
View source
<?php

/**
 * @file
 * Definition of Drupal\views\Tests\Uses\AccessTestBase.
 */
namespace Drupal\views\Tests\User;


/**
 * A common test base class for the user access plugin tests.
 */
abstract class AccessTestBase extends UserTestBase {

  /**
   * Contains a user object that can access all views.
   *
   * @var Drupal\user\User
   */
  protected $adminUser;

  /**
   * Contains a user object that has no special permissions.
   *
   * @var Drupal\user\User
   */
  protected $webUser;

  /**
   * Contains a user object that has the 'views_test_data test permission'.
   *
   * @var Drupal\user\User
   */
  protected $normalUser;

  /**
   * Contains a role ID that is used by the webUser.
   *
   * @var string
   */
  protected $webRole;

  /**
   * Contains a role ID that is used by the normalUser.
   *
   * @var string
   */
  protected $normalRole;
  protected function setUp() {
    parent::setUp();
    $this
      ->enableViewsTestModule();
    $this->adminUser = $this
      ->drupalCreateUser(array(
      'access all views',
    ));
    $this->webUser = $this
      ->drupalCreateUser();
    $this->webRole = current($this->webUser->roles);
    $this->normalRole = $this
      ->drupalCreateRole(array());
    $this->normalUser = $this
      ->drupalCreateUser(array(
      'views_test_data test permission',
    ));
    $this->normalUser->roles[$this->normalRole] = $this->normalRole;

    // @todo when all the plugin information is cached make a reset function and
    // call it here.
  }

}

Classes

Namesort descending Description
AccessTestBase A common test base class for the user access plugin tests.