public function BlockContentAccessHandlerTest::providerTestAccess in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block_content/tests/src/Kernel/BlockContentAccessHandlerTest.php \Drupal\Tests\block_content\Kernel\BlockContentAccessHandlerTest::providerTestAccess()
Data provider for testAccess().
File
- core/
modules/ block_content/ tests/ src/ Kernel/ BlockContentAccessHandlerTest.php, line 161
Class
- BlockContentAccessHandlerTest
- Tests the block content entity access handler.
Namespace
Drupal\Tests\block_content\KernelCode
public function providerTestAccess() {
$cases = [
'view:published:reusable' => [
'view',
TRUE,
TRUE,
[],
NULL,
'allowed',
],
'view:unpublished:reusable' => [
'view',
FALSE,
TRUE,
[],
NULL,
'neutral',
],
'view:unpublished:reusable:admin' => [
'view',
FALSE,
TRUE,
[
'administer blocks',
],
NULL,
'allowed',
],
'view:published:reusable:admin' => [
'view',
TRUE,
TRUE,
[
'administer blocks',
],
NULL,
'allowed',
],
'view:published:non_reusable' => [
'view',
TRUE,
FALSE,
[],
NULL,
'forbidden',
],
'view:published:non_reusable:parent_allowed' => [
'view',
TRUE,
FALSE,
[],
'allowed',
'allowed',
],
'view:published:non_reusable:parent_neutral' => [
'view',
TRUE,
FALSE,
[],
'neutral',
'neutral',
],
'view:published:non_reusable:parent_forbidden' => [
'view',
TRUE,
FALSE,
[],
'forbidden',
'forbidden',
],
];
foreach ([
'update',
'delete',
] as $operation) {
$cases += [
$operation . ':published:reusable' => [
$operation,
TRUE,
TRUE,
[],
NULL,
'neutral',
],
$operation . ':unpublished:reusable' => [
$operation,
FALSE,
TRUE,
[],
NULL,
'neutral',
],
$operation . ':unpublished:reusable:admin' => [
$operation,
FALSE,
TRUE,
[
'administer blocks',
],
NULL,
'allowed',
],
$operation . ':published:reusable:admin' => [
$operation,
TRUE,
TRUE,
[
'administer blocks',
],
NULL,
'allowed',
],
$operation . ':published:non_reusable' => [
$operation,
TRUE,
FALSE,
[],
NULL,
'forbidden',
],
$operation . ':published:non_reusable:parent_allowed' => [
$operation,
TRUE,
FALSE,
[],
'allowed',
'neutral',
],
$operation . ':published:non_reusable:parent_neutral' => [
$operation,
TRUE,
FALSE,
[],
'neutral',
'neutral',
],
$operation . ':published:non_reusable:parent_forbidden' => [
$operation,
TRUE,
FALSE,
[],
'forbidden',
'forbidden',
],
];
}
return $cases;
}