protected function ResourceTestBase::grantIncludedPermissions in Drupal 9
Same name and namespace in other branches
- 8 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::grantIncludedPermissions()
Grants authorization to view includes.
Parameters
string[] $include_paths: An array of include paths for which to grant access.
1 call to ResourceTestBase::grantIncludedPermissions()
- ResourceTestBase::doTestIncluded in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Tests included resources.
File
- core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 3475
Class
- ResourceTestBase
- Subclass this for every JSON:API resource type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function grantIncludedPermissions(array $include_paths = []) {
$applicable_permissions = array_intersect_key(static::getIncludePermissions(), array_flip($include_paths));
$flattened_permissions = array_unique(array_reduce($applicable_permissions, 'array_merge', []));
// Always grant access to 'view' the test entity reference field.
$flattened_permissions[] = 'field_jsonapi_test_entity_ref view access';
$this
->grantPermissionsToTestedRole($flattened_permissions);
}