protected function ProfileRoleAccessTest::setUp in Profile 8
Overrides EntityKernelTestBase::setUp
File
- tests/
src/ Kernel/ ProfileRoleAccessTest.php, line 87
Class
- ProfileRoleAccessTest
- Tests profile role access handling.
Namespace
Drupal\Tests\profile\KernelCode
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('profile');
$this->role1 = Role::create([
'id' => strtolower($this
->randomMachineName(8)),
'label' => $this
->randomMachineName(8),
]);
$this->role1
->save();
$this->role2 = Role::create([
'id' => strtolower($this
->randomMachineName(8)),
'label' => $this
->randomMachineName(8),
]);
$this->role2
->save();
$this->type1 = $this
->createProfileType(NULL, NULL, FALSE, []);
$this->type2 = $this
->createProfileType(NULL, NULL, FALSE, [
$this->role2
->id(),
]);
$this->type3 = $this
->createProfileType(NULL, NULL, FALSE, [
$this->role1
->id(),
$this->role2
->id(),
]);
$this->accessHandler = $this->container
->get('entity_type.manager')
->getAccessControlHandler('profile');
$this->accessManager = $this->container
->get('access_manager');
// Do not allow uid == 1 to skew tests.
$this
->createUser();
}