function ResourceTestBase::revokePermissions
Same name in other branches
- 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::revokePermissions()
Ensure the anonymous and authenticated roles have no permissions at all.
3 calls to ResourceTestBase::revokePermissions()
- FileTest::testIndividual in core/
modules/ jsonapi/ tests/ src/ Functional/ FileTest.php - Tests POST/PATCH/DELETE for an individual resource.
- ResourceTestBase::setUp in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - ResourceTestBase::testIndividual in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Tests POST/PATCH/DELETE for an individual resource.
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 3564
Class
- ResourceTestBase
- Subclass this for every JSON:API resource type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function revokePermissions() : void {
$user_role = Role::load(RoleInterface::ANONYMOUS_ID);
foreach ($user_role->getPermissions() as $permission) {
$user_role->revokePermission($permission);
}
$user_role->save();
assert([] === $user_role->getPermissions(), 'The anonymous user role has no permissions at all.');
$user_role = Role::load(RoleInterface::AUTHENTICATED_ID);
foreach ($user_role->getPermissions() as $permission) {
$user_role->revokePermission($permission);
}
$user_role->save();
assert([] === $user_role->getPermissions(), 'The authenticated user role has no permissions at all.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.