class AccessTestBase
Same name and namespace in other branches
- 11.x core/modules/user/tests/src/Functional/Views/AccessTestBase.php \Drupal\Tests\user\Functional\Views\AccessTestBase
- 10 core/modules/user/tests/src/Functional/Views/AccessTestBase.php \Drupal\Tests\user\Functional\Views\AccessTestBase
- 8.9.x core/modules/user/tests/src/Functional/Views/AccessTestBase.php \Drupal\Tests\user\Functional\Views\AccessTestBase
A common test base class for the user access plugin tests.
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\user\Functional\Views\UserTestBase extends \Drupal\Tests\views\Functional\ViewTestBase
- class \Drupal\Tests\user\Functional\Views\AccessTestBase extends \Drupal\Tests\user\Functional\Views\UserTestBase
- class \Drupal\Tests\user\Functional\Views\UserTestBase extends \Drupal\Tests\views\Functional\ViewTestBase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of AccessTestBase
File
-
core/
modules/ user/ tests/ src/ Functional/ Views/ AccessTestBase.php, line 8
Namespace
Drupal\Tests\user\Functional\ViewsView source
abstract class AccessTestBase extends UserTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'block',
];
/**
* Contains a user object that has no special permissions.
*
* @var \Drupal\user\UserInterface
*/
protected $webUser;
/**
* Contains a user object that has the 'views_test_data test permission'.
*
* @var \Drupal\user\UserInterface
*/
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;
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE, $modules = []) {
parent::setUp($import_test_views, $modules);
$this->drupalPlaceBlock('system_breadcrumb_block');
$this->enableViewsTestModule();
$this->webUser = $this->drupalCreateUser();
$roles = $this->webUser
->getRoles();
$this->webRole = $roles[0];
$this->normalRole = $this->drupalCreateRole([]);
$this->normalUser = $this->drupalCreateUser([
'views_test_data test permission',
]);
$this->normalUser
->addRole($this->normalRole);
$this->normalUser
->save();
// @todo when all the plugin information is cached make a reset function and
// call it here.
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.