function BlockContentAccessHandlerTest::setUp
Same name in other branches
- 9 core/modules/block_content/tests/src/Kernel/BlockContentAccessHandlerTest.php \Drupal\Tests\block_content\Kernel\BlockContentAccessHandlerTest::setUp()
- 10 core/modules/block_content/tests/src/Kernel/BlockContentAccessHandlerTest.php \Drupal\Tests\block_content\Kernel\BlockContentAccessHandlerTest::setUp()
- 11.x core/modules/block_content/tests/src/Kernel/BlockContentAccessHandlerTest.php \Drupal\Tests\block_content\Kernel\BlockContentAccessHandlerTest::setUp()
Overrides KernelTestBase::setUp
File
-
core/
modules/ block_content/ tests/ src/ Kernel/ BlockContentAccessHandlerTest.php, line 57
Class
- BlockContentAccessHandlerTest
- Tests the block content entity access handler.
Namespace
Drupal\Tests\block_content\KernelCode
protected function setUp() {
parent::setUp();
$this->installSchema('system', [
'sequences',
]);
$this->installSchema('user', [
'users_data',
]);
$this->installEntitySchema('user');
$this->installEntitySchema('block_content');
// Create a block content type.
$block_content_type = BlockContentType::create([
'id' => 'square',
'label' => 'A square block type',
'description' => "Provides a block type that is square.",
]);
$block_content_type->save();
$this->blockEntity = BlockContent::create([
'info' => 'The Block',
'type' => 'square',
]);
$this->blockEntity
->save();
// Create user 1 test does not have all permissions.
User::create([
'name' => 'admin',
])->save();
$this->role = Role::create([
'id' => 'roly',
'label' => 'roly poly',
]);
$this->role
->save();
$this->accessControlHandler = new BlockContentAccessControlHandler(\Drupal::entityTypeManager()->getDefinition('block_content'), \Drupal::service('event_dispatcher'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.