AccessTestBase.php in Drupal 10
File
core/modules/user/tests/src/Functional/Views/AccessTestBase.php
View source
<?php
namespace Drupal\Tests\user\Functional\Views;
abstract class AccessTestBase extends UserTestBase {
protected static $modules = [
'block',
];
protected $webUser;
protected $normalUser;
protected $webRole;
protected $normalRole;
protected function setUp($import_test_views = TRUE, $modules = []) : void {
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();
}
}
Classes
Name |
Description |
AccessTestBase |
A common test base class for the user access plugin tests. |